Code

Merge branch 'maint'
[git.git] / t / t7400-submodule-basic.sh
index 132d0b996375ed4b884df36b98a4460d7cc42c58..0f2ccc6cf0123951d9bdbb880931868f29de5b4e 100755 (executable)
@@ -64,7 +64,17 @@ test_expect_success 'submodule add' '
        )
 '
 
-test_expect_failure 'submodule add with ./ in path' '
+test_expect_success 'submodule add --branch' '
+       (
+               cd addtest &&
+               git submodule add -b initial "$submodurl" submod-branch &&
+               git submodule init &&
+               cd submod-branch &&
+               git branch | grep initial
+       )
+'
+
+test_expect_success 'submodule add with ./ in path' '
        (
                cd addtest &&
                git submodule add "$submodurl" ././dotsubmod/./frotz/./ &&
@@ -72,7 +82,7 @@ test_expect_failure 'submodule add with ./ in path' '
        )
 '
 
-test_expect_failure 'submodule add with // in path' '
+test_expect_success 'submodule add with // in path' '
        (
                cd addtest &&
                git submodule add "$submodurl" slashslashsubmod///frotz// &&
@@ -80,7 +90,7 @@ test_expect_failure 'submodule add with // in path' '
        )
 '
 
-test_expect_failure 'submodule add with /.. in path' '
+test_expect_success 'submodule add with /.. in path' '
        (
                cd addtest &&
                git submodule add "$submodurl" dotdotsubmod/../realsubmod/frotz/.. &&
@@ -88,7 +98,7 @@ test_expect_failure 'submodule add with /.. in path' '
        )
 '
 
-test_expect_failure 'submodule add with ./, /.. and // in path' '
+test_expect_success 'submodule add with ./, /.. and // in path' '
        (
                cd addtest &&
                git submodule add "$submodurl" dot/dotslashsubmod/./../..////realsubmod2/a/b/c/d/../../../../frotz//.. &&
@@ -283,4 +293,17 @@ test_expect_success 'gracefully add submodule with a trailing slash' '
 
 '
 
+test_expect_success 'ls-files gracefully handles trailing slash' '
+
+       test "init" = "$(git ls-files init/)"
+
+'
+
+test_expect_success 'submodule <invalid-path> warns' '
+
+       git submodule no-such-submodule 2> output.err &&
+       grep "^error: .*no-such-submodule" output.err
+
+'
+
 test_done