Code

Sync with 1.7.9.5
[git.git] / t / t7400-submodule-basic.sh
index 69115269c2a284dcfc99abd2f7feb3d87f4e5bcc..b377a7af28c9dde11bd4cf6adcf0d7eae31a0754 100755 (executable)
@@ -79,6 +79,15 @@ test_expect_success 'submodule add' '
                cd addtest &&
                git submodule add -q "$submodurl" submod >actual &&
                test ! -s actual &&
+               echo "gitdir: ../.git/modules/submod" >expect &&
+               test_cmp expect submod/.git &&
+               (
+                       cd submod &&
+                       git config core.worktree >actual &&
+                       echo "../../../submod" >expect &&
+                       test_cmp expect actual &&
+                       rm -f actual expect
+               ) &&
                git submodule init
        ) &&
 
@@ -362,10 +371,10 @@ test_expect_success 'update --init' '
        git submodule update init > update.out &&
        cat update.out &&
        test_i18ngrep "not initialized" update.out &&
-       ! test -d init/.git &&
+       test_must_fail git rev-parse --resolve-git-dir init/.git &&
 
        git submodule update --init init &&
-       test -d init/.git
+       git rev-parse --resolve-git-dir init/.git
 '
 
 test_expect_success 'do not add files from a submodule' '
@@ -498,4 +507,17 @@ test_expect_success 'relative path works with user@host:path' '
        )
 '
 
+test_expect_success 'moving the superproject does not break submodules' '
+       (
+               cd addtest &&
+               git submodule status >expect
+       )
+       mv addtest addtest2 &&
+       (
+               cd addtest2 &&
+               git submodule status >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_done