summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-07-13 14:31:35 -0700
committerJunio C Hamano <gitster@pobox.com>2011-07-13 14:31:35 -0700
commitff968f03e6951e8ee84cfb923f8905296286134a (patch)
treefc0bdcd4cc3562610de64b6c43661cd38e9fb09c /git-submodule.sh
parent5f2e448370e7c436b9ad7e7c495f4c96630f3e3c (diff)
parent877449c136539cf8b9b4ed9cfe33a796b7b93f93 (diff)
downloadgit-ff968f03e6951e8ee84cfb923f8905296286134a.tar.gz
Merge branch 'fg/submodule-keep-updating'
* fg/submodule-keep-updating: git-submodule.sh: clarify the "should we die now" logic submodule update: continue when a checkout fails git-sh-setup: add die_with_status Conflicts: git-submodule.sh
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh49
1 files changed, 44 insertions, 5 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index c571d320d0..cfd5aa6049 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -448,7 +448,8 @@ cmd_update()
fi
cloned_modules=
- module_list "$@" |
+ module_list "$@" | {
+ err=
while read mode sha1 stage path
do
if test "$stage" = U
@@ -511,16 +512,19 @@ Maybe you want to use 'update --init'?")"
update_module= ;;
esac
+ must_die_on_failure=
case "$update_module" in
rebase)
command="git rebase"
die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$path'")"
say_msg="$(eval_gettext "Submodule path '\$path': rebased into '\$sha1'")"
+ must_die_on_failure=yes
;;
merge)
command="git merge"
die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$path'")"
say_msg="$(eval_gettext "Submodule path '\$path': merged in '\$sha1'")"
+ must_die_on_failure=yes
;;
*)
command="git checkout $subforce -q"
@@ -529,16 +533,51 @@ Maybe you want to use 'update --init'?")"
;;
esac
- (clear_local_git_env; cd "$path" && $command "$sha1") || die $die_msg
- say $say_msg
+ if (clear_local_git_env; cd "$path" && $command "$sha1")
+ then
+ say "$say_msg"
+ elif test -n "$must_die_on_failure"
+ then
+ die_with_status 2 "$die_msg"
+ else
+ err="${err};$die_msg"
+ continue
+ fi
fi
if test -n "$recursive"
then
- (clear_local_git_env; cd "$path" && eval cmd_update "$orig_flags") ||
- die "$(eval_gettext "Failed to recurse into submodule path '\$path'")"
+ (clear_local_git_env; cd "$path" && eval cmd_update "$orig_flags")
+ res=$?
+ if test $res -gt 0
+ then
+ die_msg="$(eval_gettext "Failed to recurse into submodule path '\$path'")"
+ if test $res -eq 1
+ then
+ err="${err};$die_msg"
+ continue
+ else
+ die_with_status $res "$die_msg"
+ fi
+ fi
fi
done
+
+ if test -n "$err"
+ then
+ OIFS=$IFS
+ IFS=';'
+ for e in $err
+ do
+ if test -n "$e"
+ then
+ echo >&2 "$e"
+ fi
+ done
+ IFS=$OIFS
+ exit 1
+ fi
+ }
}
set_name_rev () {