Merge branch 'ky/branch-d-worktree' into maint
[gitweb.git] / t / t7400-submodule-basic.sh
index 540771ca419b82e4dd32adf986545515fa1db66e..e1abd1923033617540c915af4372ba42936326d0 100755 (executable)
@@ -849,6 +849,19 @@ test_expect_success 'set up a second submodule' '
        git commit -m "submodule example2 added"
 '
 
+test_expect_success 'submodule deinit works on repository without submodules' '
+       test_when_finished "rm -rf newdirectory" &&
+       mkdir newdirectory &&
+       (
+               cd newdirectory &&
+               git init &&
+               >file &&
+               git add file &&
+               git commit -m "repo should not be empty"
+               git submodule deinit .
+       )
+'
+
 test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
        git config submodule.example.foo bar &&
        git config submodule.example2.frotz nitfol &&
@@ -999,5 +1012,30 @@ test_expect_success 'submodule add clone shallow submodule' '
        )
 '
 
+test_expect_success 'submodule helper list is not confused by common prefixes' '
+       mkdir -p dir1/b &&
+       (
+               cd dir1/b &&
+               git init &&
+               echo hi >testfile2 &&
+               git add . &&
+               git commit -m "test1"
+       ) &&
+       mkdir -p dir2/b &&
+       (
+               cd dir2/b &&
+               git init &&
+               echo hello >testfile1 &&
+               git add .  &&
+               git commit -m "test2"
+       ) &&
+       git submodule add /dir1/b dir1/b &&
+       git submodule add /dir2/b dir2/b &&
+       git commit -m "first submodule commit" &&
+       git submodule--helper list dir1/b |cut -c51- >actual &&
+       echo "dir1/b" >expect &&
+       test_cmp expect actual
+'
+
 
 test_done