From dfe1670c129c1ec6f46ae7b5cc610201a59cfbfd Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Tue, 9 Sep 2008 22:19:23 +0200 Subject: [PATCH] Fix recursive tg calls: Pass tg parameters through properly --- tg-create.sh | 4 ++-- tg-export.sh | 2 +- tg-info.sh | 2 +- tg-patch.sh | 2 +- tg-update.sh | 6 +++--- tg.sh | 4 +++- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tg-create.sh b/tg-create.sh index dd95e65..2cab492 100644 --- a/tg-create.sh +++ b/tg-create.sh @@ -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" diff --git a/tg-export.sh b/tg-export.sh index b664d8d..7fcafbe 100644 --- a/tg-export.sh +++ b/tg-export.sh @@ -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" } diff --git a/tg-info.sh b/tg-info.sh index 6c00d83..4de74cc 100644 --- a/tg-info.sh +++ b/tg-info.sh @@ -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" diff --git a/tg-patch.sh b/tg-patch.sh index 48f4d77..79e5cb3 100644 --- a/tg-patch.sh +++ b/tg-patch.sh @@ -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\`." diff --git a/tg-update.sh b/tg-update.sh index 34fa6dc..94c8b5d 100644 --- a/tg-update.sh +++ b/tg-update.sh @@ -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 2294a99..6c28467 100644 --- 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" -- 2.11.4.GIT