submodule--helper: replace connect-gitdir-workingtree by ensure-core-worktree
[gitweb.git] / git-submodule.sh
index 8b5ad59bdee39eba4fc56b28d6771a291dac55f0..19d010eac069a043dd97754f51c6c98fc6e1079a 100755 (executable)
@@ -531,9 +531,11 @@ 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"
+
+               git submodule--helper ensure-core-worktree "$sm_path"
 
                name=$(git submodule--helper name "$sm_path") || exit
                if ! test -z "$update"
@@ -577,11 +579,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 +629,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")