Merge branch 'sb/submodule-update-initial-runs-custom-script'

The user can specify a custom update method that is run when
"submodule update" updates an already checked out submodule.  This
was ignored when checking the submodule out for the first time and
we instead always just checked out the commit that is bound to the
path in the superproject's index.

* sb/submodule-update-initial-runs-custom-script:
  submodule update: run custom update script for initial populating as well
This commit is contained in:
Junio C Hamano 2017-02-03 11:25:19 -08:00
Родитель 5348021c67 e7b37caf4f
Коммит 4ba6bb2d17
2 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -613,7 +613,10 @@ cmd_update()
if test $just_cloned -eq 1
then
subsha1=
update_module=checkout
case "$update_module" in
merge | rebase | none)
update_module=checkout ;;
esac
else
subsha1=$(sanitize_submodule_env; cd "$sm_path" &&
git rev-parse --verify HEAD) ||

Просмотреть файл

@ -441,6 +441,16 @@ test_expect_success 'submodule update - command in .git/config catches failure -
test_i18ncmp actual expect
'
test_expect_success 'submodule update - command run for initial population of submodule' '
cat <<-\ EOF >expect
Execution of '\''false $submodulesha1'\'' failed in submodule path '\''submodule'\''
EOF &&
rm -rf super/submodule &&
test_must_fail git -C super submodule update >../actual &&
test_cmp expect actual &&
git -C super submodule update --checkout
'
cat << EOF >expect
Execution of 'false $submodulesha1' failed in submodule path '../super/submodule'
Failed to recurse into submodule path '../super'
@ -493,6 +503,7 @@ test_expect_success 'submodule init picks up merge' '
'
test_expect_success 'submodule update --merge - ignores --merge for new submodules' '
test_config -C super submodule.submodule.update checkout &&
(cd super &&
rm -rf submodule &&
git submodule update submodule &&
@ -505,6 +516,7 @@ test_expect_success 'submodule update --merge - ignores --merge for new submod
'
test_expect_success 'submodule update --rebase - ignores --rebase for new submodules' '
test_config -C super submodule.submodule.update checkout &&
(cd super &&
rm -rf submodule &&
git submodule update submodule &&