diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-06-13 12:17:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-06-13 12:18:29 -0700 |
commit | 877449c136539cf8b9b4ed9cfe33a796b7b93f93 (patch) | |
tree | 3f84c20992854cb84aa6a927b1419180463133d8 /git-submodule.sh | |
parent | 15ffb7cde48b73b3d5ce259443db7d2e0ba13750 (diff) | |
download | git-877449c136539cf8b9b4ed9cfe33a796b7b93f93.tar.gz git-877449c136539cf8b9b4ed9cfe33a796b7b93f93.tar.xz |
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>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index eb5eebcd9..066d6b571 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -508,16 +508,19 @@ cmd_update() update_module= ;; esac + must_die_on_failure= case "$update_module" in rebase) command="git rebase" action="rebase" msg="rebased onto" + must_die_on_failure=yes ;; merge) command="git merge" action="merge" msg="merged in" + must_die_on_failure=yes ;; *) command="git checkout $subforce -q" @@ -529,16 +532,12 @@ cmd_update() if (clear_local_git_env; cd "$path" && $command "$sha1") then 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 - case $action in - rebase|merge) - die_with_status 2 "Unable to $action '$sha1' in submodule path '$path'" - ;; - *) - err="${err};Failed to $action in submodule path '$path'" - continue - ;; - esac + err="${err};Failed to $action in submodule path '$path'" + continue fi fi |