summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh39
1 files changed, 15 insertions, 24 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 8b5ad59bde..c09eb3e03d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -82,6 +82,11 @@ isnumber()
n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
}
+# Given a full hex object ID, is this the zero OID?
+is_zero_oid () {
+ echo "$1" | sane_egrep '^0+$' >/dev/null 2>&1
+}
+
# Sanitize the local git environment for use within a submodule. We
# can't simply use clear_local_git_env since we want to preserve some
# of the settings from GIT_CONFIG_PARAMETERS.
@@ -438,6 +443,9 @@ cmd_update()
-q|--quiet)
GIT_QUIET=1
;;
+ -v)
+ GIT_QUIET=0
+ ;;
--progress)
progress=1
;;
@@ -531,31 +539,19 @@ cmd_update()
"$@" || echo "#unmatched" $?
} | {
err=
- while read -r mode sha1 stage just_cloned sm_path
+ while read -r quickabort sha1 just_cloned sm_path
do
- die_if_unmatched "$mode" "$sha1"
+ die_if_unmatched "$quickabort" "$sha1"
- name=$(git submodule--helper name "$sm_path") || exit
- if ! test -z "$update"
- then
- update_module=$update
- else
- update_module=$(git config submodule."$name".update)
- if test -z "$update_module"
- then
- update_module="checkout"
- fi
- fi
+ git submodule--helper ensure-core-worktree "$sm_path"
+
+ update_module=$(git submodule--helper update-module-mode $just_cloned "$sm_path" $update)
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
if test $just_cloned -eq 1
then
subsha1=
- case "$update_module" in
- merge | rebase | none)
- update_module=checkout ;;
- esac
else
subsha1=$(sanitize_submodule_env; cd "$sm_path" &&
git rev-parse --verify HEAD) ||
@@ -577,11 +573,6 @@ cmd_update()
die "$(eval_gettext "Unable to find current \${remote_name}/\${branch} revision in submodule path '\$sm_path'")"
fi
- if ! $(git config -f "$(git rev-parse --git-common-dir)/modules/$name/config" core.worktree) 2>/dev/null
- then
- git submodule--helper connect-gitdir-workingtree "$name" "$sm_path"
- fi
-
if test "$subsha1" != "$sha1" || test -n "$force"
then
subforce=$force
@@ -632,7 +623,7 @@ cmd_update()
must_die_on_failure=yes
;;
*)
- die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
+ die "$(eval_gettext "Invalid update mode '$update_module' for submodule path '$path'")"
esac
if (sanitize_submodule_env; cd "$sm_path" && $command "$sha1")
@@ -794,7 +785,7 @@ cmd_summary() {
while read -r mod_src mod_dst sha1_src sha1_dst status name
do
if test -z "$cached" &&
- test $sha1_dst = 0000000000000000000000000000000000000000
+ is_zero_oid $sha1_dst
then
case "$mod_dst" in
160000)