X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=tg-update.sh;h=040800d6fb3805ef92519e436fe9cbb353cdbb77;hp=34fa6dcb10f59799e0df977e98544483cff3fc30;hb=27b380077d91f2b35456d5a7a9fbb5c3b457ab5e;hpb=54f24fdf5691baa3dcc7252098efd13cc4fc1620 diff --git a/tg-update.sh b/tg-update.sh index 34fa6dc..040800d 100644 --- a/tg-update.sh +++ b/tg-update.sh @@ -9,7 +9,7 @@ name= ## Parse options if [ -n "$1" ]; then - echo "Usage: tg update" >&2 + echo "Usage: tg [...] update" >&2 exit 1 fi @@ -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="\`git checkout $name && $tg update\` again" else # subshell resume='exit' fi @@ -87,14 +87,16 @@ if [ -s "$depcheck" ]; then exit 2 fi done - - # Home, sweet home... - git checkout -q "$name" else info "The base is up-to-date." fi rm "$depcheck" +# Home, sweet home... +# (We want to always switch back, in case we were on the base from failed +# previous merge.) +git checkout -q "$name" + merge_with="refs/top-bases/$name" @@ -133,7 +135,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\`."