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>

Junio C Hamano committed Jun 13, 2011 at 12:17 UTC 877449c136539cf8b9b4ed9cfe33a796b7b93f93
1 file changed +8 -9
git-submodule.sh
+8 -9
@@ -508,16 +508,19 @@ cmd_update()
508 update_module= ;;
509 esac
510
511 + must_die_on_failure=
512 case "$update_module" in
513 rebase)
514 command="git rebase"
515 action="rebase"
516 msg="rebased onto"
517 + must_die_on_failure=yes
518 ;;
519 merge)
520 command="git merge"
521 action="merge"
522 msg="merged in"
523 + must_die_on_failure=yes
524 ;;
525 *)
526 command="git checkout $subforce -q"
@@ -529,16 +532,12 @@ cmd_update()
532 if (clear_local_git_env; cd "$path" && $command "$sha1")
533 then
534 say "Submodule path '$path': $msg '$sha1'"
535 + elif test -n "$must_die_on_failure"
536 + then
537 + die_with_status 2 "Unable to $action '$sha1' in submodule path '$path'"
538 else
533 - case $action in
534 - rebase|merge)
535 - die_with_status 2 "Unable to $action '$sha1' in submodule path '$path'"
536 - ;;
537 - *)
538 - err="${err};Failed to $action in submodule path '$path'"
539 - continue
540 - ;;
541 - esac
539 + err="${err};Failed to $action in submodule path '$path'"
540 + continue
541 fi
542 fi
543