git-submodule.sh: clarify the "should we die now" logic

Earlier the decision to stop or continue was made on the $action variable
that was set by inspecting $update_module variable. The former is a
redundant variable and will be removed in another topic.

Decide upon inspecting $update_module if a failure should cascade up to
cause us immediately stop, and use a variable that means just that, to
clarify the logic.

Incidentally this also makes the merge with the other topic slightly
easier and cleaner to understand.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2011-06-13 12:17:52 -07:00
parent 15ffb7cde4
commit 877449c136

View file

@ -508,16 +508,19 @@ cmd_update()
update_module= ;; update_module= ;;
esac esac
must_die_on_failure=
case "$update_module" in case "$update_module" in
rebase) rebase)
command="git rebase" command="git rebase"
action="rebase" action="rebase"
msg="rebased onto" msg="rebased onto"
must_die_on_failure=yes
;; ;;
merge) merge)
command="git merge" command="git merge"
action="merge" action="merge"
msg="merged in" msg="merged in"
must_die_on_failure=yes
;; ;;
*) *)
command="git checkout $subforce -q" command="git checkout $subforce -q"
@ -529,16 +532,12 @@ cmd_update()
if (clear_local_git_env; cd "$path" && $command "$sha1") if (clear_local_git_env; cd "$path" && $command "$sha1")
then then
say "Submodule path '$path': $msg '$sha1'" say "Submodule path '$path': $msg '$sha1'"
elif test -n "$must_die_on_failure"
then
die_with_status 2 "Unable to $action '$sha1' in submodule path '$path'"
else else
case $action in err="${err};Failed to $action in submodule path '$path'"
rebase|merge) continue
die_with_status 2 "Unable to $action '$sha1' in submodule path '$path'"
;;
*)
err="${err};Failed to $action in submodule path '$path'"
continue
;;
esac
fi fi
fi fi