From ee69b2a90c5031bffb3341c5e50653a6ecca89ac Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Mon, 13 Aug 2018 15:42:35 -0700 Subject: submodule--helper: introduce new update-module-mode helper This chews off a bit of the shell part of the update command in git-submodule.sh. When writing the C code, keep in mind that the submodule--helper part will go away eventually and we want to have a C function that is able to determine the submodule update strategy, it as a nicety, make determine_submodule_update_strategy accessible for arbitrary repositories. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- git-submodule.sh | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'git-submodule.sh') diff --git a/git-submodule.sh b/git-submodule.sh index 19d010eac0..19c9f1215e 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -537,27 +537,13 @@ cmd_update() git submodule--helper ensure-core-worktree "$sm_path" - 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 + 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) || -- cgit v1.3-5-g9baa