Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Gustafsson <iveqy@iveqy.com>2011-06-13 21:15:26 +0400
committerJunio C Hamano <gitster@pobox.com>2011-06-13 22:24:48 +0400
commit15ffb7cde48b73b3d5ce259443db7d2e0ba13750 (patch)
tree17a9dfd49786e66afea33b751b7e0fc60d5b89b2 /git-submodule.sh
parentadb231cfdabd9b62c2d99519ac5f8ba29d689478 (diff)
submodule update: continue when a checkout fails
"git submodule update" stops at the first error and gives control back to the user. Only after the user fixes the problematic submodule and runs "git submodule update" again, the second error is found. And the user needs to repeat until all the problems are found and fixed one by one. This is tedious. Instead, the command can remember which submodules it had trouble with, continue updating the ones it can, and report which ones had errors at the end. The user can run "git submodule update", find all the ones that need minor fixing (e.g. working tree was dirty) to fix them in a single pass. Then another "git submodule update" can be run to update all. Note that the problematic submodules are skipped only when they are to be integrated with a safer value of submodule.<name>.update option, namely "checkout". Fixing a failure in a submodule that uses "rebase" or "merge" may need an involved conflict resolution by the user, and leaving too many submodules in states that need resolution would not reduce the mental burden on the user. Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com> Mentored-by: Jens Lehmann <Jens.Lehmann@web.de> Mentored-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh50
1 files changed, 44 insertions, 6 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index d189a24c71..eb5eebcd96 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -444,7 +444,8 @@ cmd_update()
fi
cloned_modules=
- module_list "$@" |
+ module_list "$@" | {
+ err=
while read mode sha1 stage path
do
if test "$stage" = U
@@ -525,17 +526,54 @@ cmd_update()
;;
esac
- (clear_local_git_env; cd "$path" && $command "$sha1") ||
- die "Unable to $action '$sha1' in submodule path '$path'"
- say "Submodule path '$path': $msg '$sha1'"
+ if (clear_local_git_env; cd "$path" && $command "$sha1")
+ then
+ say "Submodule path '$path': $msg '$sha1'"
+ 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
+ fi
fi
if test -n "$recursive"
then
- (clear_local_git_env; cd "$path" && eval cmd_update "$orig_flags") ||
- die "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
+ if test $res -eq 1
+ then
+ err="${err};Failed to recurse into submodule path '$path'"
+ continue
+ else
+ die_with_status $res "Failed to recurse into submodule path '$path'"
+ 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 () {