tg-update: allow skipping branch if recursion fails
authorAndrey Borzenkov <arvidjaar@gmail.com>
Sat, 19 Mar 2011 16:53:10 +0000 (19 19:53 +0300)
committerAndrey Borzenkov <arvidjaar@gmail.com>
Sat, 19 Mar 2011 16:53:10 +0000 (19 19:53 +0300)
This allows user to skip failed recursive update and continue
with current state. It makes it possible to continue after
missing depenndency (which was the silent default before).

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
tg-update.sh

index 7f956ba..8d5ffc1 100644 (file)
@@ -79,10 +79,20 @@ update_branch() {
                                                # 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."
-                                               if ! sh -i </dev/tty; then
-                                                       info "Ok, you aborted the merge. Now, you just need to"
-                                                       info "switch back to some sane branch using \`git checkout\`."
-                                                       exit 3
+                                               info "Use \`exit 2\` to skip updating this branch and continue."
+                                               if sh -i </dev/tty; then
+                                                       # assume user fixed it
+                                                       continue
+                                               else
+                                                       ret=$?
+                                                       if [ $ret -eq 2 ]; then
+                                                               info "Ok, I will try to continue without updating this branch."
+                                                               break
+                                                       else
+                                                               info "Ok, you aborted the merge. Now, you just need to"
+                                                               info "switch back to some sane branch using \`git checkout\`."
+                                                               exit 3
+                                                       fi
                                                fi
                                        done
                                        )