@matheusbsbs / matheus-bagliano / commits / c9c8c56e07
Fork 0

t7406: Fix submodule init config tests

These tests have been broken since they were introduced in commits ca2cedb (git-submodule: add support for --rebase., 2009-04-24) and 42b4917 (git-submodule: add support for --merge., 2009-06-03). 'git submodule init' expects the submodules to exist in the index. In this case, the submodules don't exist and therefore looking for the submodules will always fail. To make matters worse, git submodule fails visibly to the user by saying: error: pathspec 'rebasing' did not match any file(s) known to git. Did you forget to 'git add'? but doesn't return an error code. This allows the test to fail silently. Fix it by adding the submodules first. Cc: Johan Herland <johan@herland.net> Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stephen Boyd committed Mar 5, 2010 at 00:20 UTC c9c8c56e072ae568b480eb1a808bd172bf373431
1 file changed +16 -8
t/t7406-submodule-update.sh
+16 -8
@@ -28,6 +28,8 @@ test_expect_success 'setup a submodule tree' '
28 git commit -m upstream
29 git clone . super &&
30 git clone super submodule &&
31 + git clone super rebasing &&
32 + git clone super merging &&
33 (cd super &&
34 git submodule add ../submodule submodule &&
35 test_tick &&
@@ -45,6 +47,16 @@ test_expect_success 'setup a submodule tree' '
47 ) &&
48 git add submodule &&
49 git commit -m "submodule update"
50 + ) &&
51 + (cd super &&
52 + git submodule add ../rebasing rebasing &&
53 + test_tick &&
54 + git commit -m "rebasing"
55 + ) &&
56 + (cd super &&
57 + git submodule add ../merging merging &&
58 + test_tick &&
59 + git commit -m "rebasing"
60 )
61 '
62
@@ -177,21 +189,17 @@ test_expect_success 'submodule update - checkout in .git/config' '
189
190 test_expect_success 'submodule init picks up rebase' '
191 (cd super &&
180 - git config submodule.rebasing.url git://non-existing/git &&
181 - git config submodule.rebasing.path does-not-matter &&
182 - git config submodule.rebasing.update rebase &&
192 + git config -f .gitmodules submodule.rebasing.update rebase &&
193 git submodule init rebasing &&
184 - test "rebase" = $(git config submodule.rebasing.update)
194 + test "rebase" = "$(git config submodule.rebasing.update)"
195 )
196 '
197
198 test_expect_success 'submodule init picks up merge' '
199 (cd super &&
190 - git config submodule.merging.url git://non-existing/git &&
191 - git config submodule.merging.path does-not-matter &&
192 - git config submodule.merging.update merge &&
200 + git config -f .gitmodules submodule.merging.update merge &&
201 git submodule init merging &&
194 - test "merge" = $(git config submodule.merging.update)
202 + test "merge" = "$(git config submodule.merging.update)"
203 )
204 '
205