git submodule: Add test cases for git submodule add
Add simple test cases for adding and initialising submodules. The init step is necessary in order to verify the added information. The second test exposes a known breakage due to './' in the path: git ls-files simplifies the path but git add does not, which leads to git init looking for different lines in .gitmodules than git add adds. The other tests add test cases for '//' and '..' in the path which currently fail for the same reason. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber committed
Mar 3, 2009 at 16:08 UTC
ac8463d2b4c0e88011c40985bc519c0e2e2f2278
1 file changed
+49
t/t7400-submodule-basic.sh
+49
@@ -47,6 +47,55 @@ test_expect_success 'Prepare submodule testing' '
47
GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git
48
'
49
50
+test_expect_success 'Prepare submodule add testing' '
51
+ submodurl=$(pwd)
52
+ (
53
+ mkdir addtest &&
54
+ cd addtest &&
55
+ git init
56
+ )
57
+'
58
+
59
+test_expect_success 'submodule add' '
60
+ (
61
+ cd addtest &&
62
+ git submodule add "$submodurl" submod &&
63
+ git submodule init
64
+ )
65
+'
66
+
67
+test_expect_failure 'submodule add with ./ in path' '
68
+ (
69
+ cd addtest &&
70
+ git submodule add "$submodurl" ././dotsubmod/./frotz/./ &&
71
+ git submodule init
72
+ )
73
+'
74
+
75
+test_expect_failure 'submodule add with // in path' '
76
+ (
77
+ cd addtest &&
78
+ git submodule add "$submodurl" slashslashsubmod///frotz// &&
79
+ git submodule init
80
+ )
81
+'
82
+
83
+test_expect_failure 'submodule add with /.. in path' '
84
+ (
85
+ cd addtest &&
86
+ git submodule add "$submodurl" dotdotsubmod/../realsubmod/frotz/.. &&
87
+ git submodule init
88
+ )
89
+'
90
+
91
+test_expect_failure 'submodule add with ./, /.. and // in path' '
92
+ (
93
+ cd addtest &&
94
+ git submodule add "$submodurl" dot/dotslashsubmod/./../..////realsubmod2/a/b/c/d/../../../../frotz//.. &&
95
+ git submodule init
96
+ )
97
+'
98
+
99
test_expect_success 'status should fail for unmapped paths' '
100
if git submodule status
101
then