chiark / gitweb /
Fix recursive tg calls: Pass tg parameters through properly
authorPetr Baudis <pasky@suse.cz>
Tue, 9 Sep 2008 20:19:23 +0000 (22:19 +0200)
committerPetr Baudis <pasky@suse.cz>
Tue, 9 Sep 2008 20:19:23 +0000 (22:19 +0200)
tg-create.sh
tg-export.sh
tg-info.sh
tg-patch.sh
tg-update.sh
tg.sh

index dd95e6596876d38e1357435267c46f67783ebbe0..2cab492d2be88aad03e5b5aa7b4101162ee645a7 100644 (file)
@@ -82,7 +82,7 @@ while [ -n "$merge" ]; do
        info "Merging $name base with $branch..."
 
        if ! git merge "$branch"; then
-               info "Please commit merge resolution and call: tg create"
+               info "Please commit merge resolution and call: $tg create"
                info "It is also safe to abort this operation using:"
                info "git reset --hard some_branch"
                info "(You are on a detached HEAD now.)"
@@ -123,4 +123,4 @@ git add -f "$root_dir/.topmsg"
 
 
 info "Topic branch $name set up. Please fill .topmsg now and make initial commit."
-info "To abort: git rm -f .top* && git checkout ${deps%% *} && tg delete $name"
+info "To abort: git rm -f .top* && git checkout ${deps%% *} && $tg delete $name"
index b664d8dc00a7ec5190dbdbcb297574f38e5f6624..7fcafbeabd556c5bb0701178ab05e0c28f558cbd 100644 (file)
@@ -151,7 +151,7 @@ quilt()
 
        echo "Exporting $_dep"
        mkdir -p "$(dirname "$filename")"
-       tg patch "$_dep" >"$filename"
+       $tg patch "$_dep" >"$filename"
        echo "$_dep.diff -p1" >>"$output/series"
 }
 
index 6c00d83b8804c2788665d17cc977ccf42dc556a8..4de74cc1278786138274c434f0ecade5c4ab5d74 100644 (file)
@@ -36,7 +36,7 @@ git cat-file blob "$name:.topmsg" | grep ^Subject:
 
 echo "Base: $base_rev"
 branch_contains "$name" "$base_rev" ||
-       echo "* Base is newer than head! Please run \`tg update\`."
+       echo "* Base is newer than head! Please run \`$tg update\`."
 
 if has_remote "$name"; then
        echo "Remote Mate: $base_remote/$name"
index 48f4d770059bc7e7cb99bd8b005ad1ae1aeb932e..79e5cb3890a142a048cc2013089150fc24dad20b 100644 (file)
@@ -43,4 +43,4 @@ rm "$git_is_stupid"
 echo '-- '
 echo "tg: ($base_rev..) $name (depends on: $(git cat-file blob "$name:.topdeps" | paste -s -d' '))"
 branch_contains "$name" "$base_rev" ||
-       echo "tg: The patch is out-of-date wrt. the base! Run \`tg update\`."
+       echo "tg: The patch is out-of-date wrt. the base! Run \`$tg update\`."
index 34fa6dcb10f59799e0df977e98544483cff3fc30..94c8b5d16d5521bc0105140a836dc931e7d8a018 100644 (file)
@@ -54,7 +54,7 @@ if [ -s "$depcheck" ]; then
                                (
                                export TG_RECURSIVE="[$dep] $TG_RECURSIVE"
                                export PS1="[$dep] $PS1"
-                               while ! tg update; do
+                               while ! $tg update; do
                                        # The merge got stuck! Let the user fix it up.
                                        info "You are in a subshell. If you abort the merge,"
                                        info "use \`exit 1\` to abort the recursive update altogether."
@@ -75,7 +75,7 @@ if [ -s "$depcheck" ]; then
                        info "Updating base with $dep changes..."
                        if ! git merge "$dep"; then
                                if [ -z "$TG_RECURSIVE" ]; then
-                                       resume='`tg update` again'
+                                       resume='`$tg update` again'
                                else # subshell
                                        resume='exit'
                                fi
@@ -133,7 +133,7 @@ if ! git merge "$merge_with"; then
        if [ -z "$TG_RECURSIVE" ]; then
                info "Please commit merge resolution. No need to do anything else"
                info "You can abort this operation using \`git reset --hard\` now"
-               info "and retry this merge later using \`tg update\`."
+               info "and retry this merge later using \`$tg update\`."
        else # subshell
                info "Please commit merge resolution and call exit."
                info "You can abort this operation using \`git reset --hard\`."
diff --git a/tg.sh b/tg.sh
index 2294a99250b220ee5eed62b2465490948fb5ad23..6c28467d8829f46d370c415d051ff453cf0e646c 100644 (file)
--- a/tg.sh
+++ b/tg.sh
@@ -20,7 +20,7 @@ die()
 # setup_hook NAME
 setup_hook()
 {
-       hook_call="\"\$(tg --hooks-path)\"/$1 \"\$@\""
+       hook_call="\"\$($tg --hooks-path)\"/$1 \"\$@\""
        if [ -f "$git_dir/hooks/$1" ] &&
           fgrep -q "$hook_call" "$git_dir/hooks/$1"; then
                # Another job well done!
@@ -238,6 +238,7 @@ set -e
 git_dir="$(git rev-parse --git-dir)"
 root_dir="$(git rev-parse --show-cdup)"; root_dir="${root_dir:-.}"
 base_remote="$(git config topgit.remote 2>/dev/null)" || :
+tg="tg"
 # make sure merging the .top* files will always behave sanely
 setup_ours
 setup_hook "pre-commit"
@@ -253,6 +254,7 @@ setup_hook "pre-commit"
 
 if [ "$1" = "-r" ]; then
        shift; base_remote="$1"; shift
+       tg="$tg -r $base_remote"
 fi
 
 cmd="$1"