Merge branch 'sb/submodule-update-in-c'

"git submodule update" is getting rewritten piece-by-piece into C.

* sb/submodule-update-in-c:
  submodule--helper: introduce new update-module-mode helper
  submodule--helper: replace connect-gitdir-workingtree by ensure-core-worktree
  builtin/submodule--helper: factor out method to update a single submodule
  builtin/submodule--helper: store update_clone information in a struct
  builtin/submodule--helper: factor out submodule updating
  git-submodule.sh: rename unused variables
  git-submodule.sh: align error reporting for update mode to use path
This commit is contained in:
Junio C Hamano
2018-09-17 13:53:51 -07:00
2 changed files with 164 additions and 52 deletions

View File

@ -534,31 +534,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) ||
@ -630,7 +618,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")