git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t7406: Fix submodule init config tests
@ 2010-03-05  8:20 Stephen Boyd
  2010-03-07  4:00 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Boyd @ 2010-03-05  8:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johan Herland, Peter Hutterer,
	Johannes Schindelin

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>
---

The documentation for submodule init is a bit misleading too. It sounds
like submodule init will just read the .gitmodules file and copy settings
to the .git/config, but it actually needs the submodules in the index to
copy anything.

Should the behavior of submodule init should change to match the docs?

 t/t7406-submodule-update.sh |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 8e2449d..1382a8e 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -28,6 +28,8 @@ test_expect_success 'setup a submodule tree' '
 	git commit -m upstream
 	git clone . super &&
 	git clone super submodule &&
+	git clone super rebasing &&
+	git clone super merging &&
 	(cd super &&
 	 git submodule add ../submodule submodule &&
 	 test_tick &&
@@ -45,6 +47,16 @@ test_expect_success 'setup a submodule tree' '
 	 ) &&
 	 git add submodule &&
 	 git commit -m "submodule update"
+	) &&
+	(cd super &&
+	 git submodule add ../rebasing rebasing &&
+	 test_tick &&
+	 git commit -m "rebasing"
+	) &&
+	(cd super &&
+	 git submodule add ../merging merging &&
+	 test_tick &&
+	 git commit -m "rebasing"
 	)
 '
 
@@ -177,21 +189,17 @@ test_expect_success 'submodule update - checkout in .git/config' '
 
 test_expect_success 'submodule init picks up rebase' '
 	(cd super &&
-	 git config submodule.rebasing.url git://non-existing/git &&
-	 git config submodule.rebasing.path does-not-matter &&
-	 git config submodule.rebasing.update rebase &&
+	 git config -f .gitmodules submodule.rebasing.update rebase &&
 	 git submodule init rebasing &&
-	 test "rebase" = $(git config submodule.rebasing.update)
+	 test "rebase" = "$(git config submodule.rebasing.update)"
 	)
 '
 
 test_expect_success 'submodule init picks up merge' '
 	(cd super &&
-	 git config submodule.merging.url git://non-existing/git &&
-	 git config submodule.merging.path does-not-matter &&
-	 git config submodule.merging.update merge &&
+	 git config -f .gitmodules submodule.merging.update merge &&
 	 git submodule init merging &&
-	 test "merge" = $(git config submodule.merging.update)
+	 test "merge" = "$(git config submodule.merging.update)"
 	)
 '
 
-- 
1.7.0.1.138.ga75b

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] t7406: Fix submodule init config tests
  2010-03-05  8:20 [PATCH] t7406: Fix submodule init config tests Stephen Boyd
@ 2010-03-07  4:00 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2010-03-07  4:00 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: git, Johan Herland, Peter Hutterer, Johannes Schindelin

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-07  4:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-05  8:20 [PATCH] t7406: Fix submodule init config tests Stephen Boyd
2010-03-07  4:00 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).