)
'
-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/./ &&
)
'
-test_expect_failure 'submodule add with // in path' '
+test_expect_success 'submodule add with // in path' '
(
cd addtest &&
git submodule add "$submodurl" slashslashsubmod///frotz// &&
)
'
-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/.. &&
)
'
-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//.. &&
'
+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