aboutsummaryrefslogtreecommitdiff
path: root/t/t7406-submodule-update.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-02-27 14:01:31 -0800
committerJunio C Hamano <gitster@pobox.com>2014-02-27 14:01:33 -0800
commit06c27689ddba0235ef4544cd4b2763c2572f9715 (patch)
treeb5f8f0c43d061fd95a74a0dc63c1898b1d4716b9 /t/t7406-submodule-update.sh
parent043478308feec3cda9b3473bc0b79396cb9d4db6 (diff)
parent9937e65d8835ee6c026892de48f993d7a524a00f (diff)
downloadgit-06c27689ddba0235ef4544cd4b2763c2572f9715.tar.gz
git-06c27689ddba0235ef4544cd4b2763c2572f9715.tar.xz
Merge branch 'wk/submodule-on-branch'
Make sure 'submodule update' modes that do not detach HEADs can be used more pleasantly by checking out a concrete branch when cloning them to prime the well. * wk/submodule-on-branch: Documentation: describe 'submodule update --remote' use case submodule: explicit local branch creation in module_clone submodule: document module_clone arguments in comments submodule: make 'checkout' update_module mode more explicit
Diffstat (limited to 't/t7406-submodule-update.sh')
-rwxr-xr-xt/t7406-submodule-update.sh38
1 files changed, 37 insertions, 1 deletions
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 0246e80b1..28ca76384 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -63,6 +63,9 @@ test_expect_success 'setup a submodule tree' '
git submodule add ../none none &&
test_tick &&
git commit -m "none"
+ ) &&
+ (cd super &&
+ git tag initial-setup
)
'
@@ -703,7 +706,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
git clone super_update_r super_update_r2 &&
(cd super_update_r2 &&
git submodule update --init --recursive >actual &&
- test_i18ngrep "Submodule path .submodule/subsubmodule.: checked out" actual &&
+ test_i18ngrep "Submodule path .submodule/subsubmodule.: .git reset --hard -q" actual &&
(cd submodule/subsubmodule &&
git log > ../../expected
) &&
@@ -775,4 +778,37 @@ test_expect_success 'submodule update --recursive drops module name before recur
)
'
+test_expect_success 'submodule update --checkout clones detached HEAD' '
+ git clone super super4 &&
+ echo "detached HEAD" >expected &&
+ (cd super4 &&
+ git reset --hard initial-setup &&
+ git submodule init submodule &&
+ git submodule update >> /tmp/log 2>&1 &&
+ (cd submodule &&
+ git symbolic-ref HEAD > ../../actual ||
+ echo "detached HEAD" > ../../actual
+ )
+ ) &&
+ test_cmp actual expected &&
+ rm -rf super4
+'
+
+test_expect_success 'submodule update --merge clones attached HEAD' '
+ git clone super super4 &&
+ echo "refs/heads/master" >expected &&
+ (cd super4 &&
+ git reset --hard initial-setup &&
+ git submodule init submodule &&
+ git config submodule.submodule.update merge &&
+ git submodule update --merge &&
+ (cd submodule &&
+ git symbolic-ref HEAD > ../../actual ||
+ echo "detached HEAD" > ../../actual
+ )
+ ) &&
+ test_cmp actual expected &&
+ rm -rf super4
+'
+
test_done