git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 2/4] change submodule push test to use proper repository setup

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Oct 6, 2017, 22:32 UTC
Message-ID
<20171006223234.GC26642@sandbox>
In-Reply-To
<20171006222544.GA26642@sandbox>
NOTE: The argument in this message is not correct, see description in
cover letter.

The setup of the repositories in this test is using gitlinks without the .gitmodules infrastructure. It is however testing convenience features like --recurse-submodules=on-demand. These features are already not supported by fetch without a .gitmodules file. This leads us to the conclusion that it is not really used here as well.

Let's use the usual submodule commands to setup the repository in a typical way. This also has the advantage that we are testing with a repository structure that is more similar to one we could expect on a users setup.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---

As mentioned in the cover letter. This seems to be the only test that ensures that we stay compatible with setups without .gitmodules. Maybe we should add/revive some?

Cheers Heiko
 t/t5531-deep-submodule-push.sh | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 39cb2c1..a4a2c6a 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -8,22 +8,26 @@ test_expect_success setup '
 	mkdir pub.git &&
 	GIT_DIR=pub.git git init --bare &&
 	GIT_DIR=pub.git git config receive.fsckobjects true &&
+	mkdir submodule &&
+	(
+		cd submodule &&
+		git init &&
+		git config push.default matching &&
+		>junk &&
+		git add junk &&
+		git commit -m "Initial junk"
+	) &&
+	git clone --bare submodule submodule.git &&
 	mkdir work &&
 	(
 		cd work &&
 		git init &&
 		git config push.default matching &&
-		mkdir -p gar/bage &&
-		(
-			cd gar/bage &&
-			git init &&
-			git config push.default matching &&
-			>junk &&
-			git add junk &&
-			git commit -m "Initial junk"
-		) &&
-		git add gar/bage &&
+		mkdir gar &&
+		git submodule add ../submodule.git gar/bage &&
 		git commit -m "Initial superproject"
+		cd gar/bage &&
+		git remote rm origin
 	)
 '
 
@@ -51,11 +55,10 @@ test_expect_success 'push if submodule has no remote' '
 
 test_expect_success 'push fails if submodule commit not on remote' '
 	(
-		cd work/gar &&
-		git clone --bare bage ../../submodule.git &&
-		cd bage &&
+		cd work/gar/bage &&
 		git remote add origin ../../../submodule.git &&
 		git fetch &&
+		git push --set-upstream origin master &&
 		>junk3 &&
 		git add junk3 &&
 		git commit -m "Third junk"
-- 
2.10.0.129.g35f6318
Previous: Heiko VoigtNext: Stefan Beller
Message 3 of 18 in “implement fetching of moved submodules”
  1. 0/4 implement fetching of moved submodulesHeiko Voigt, Oct 6, 2017
  2. 1/4 fetch: add test to make sure we stay backwards compatibleHeiko Voigt, Oct 6, 2017
  3. 2/4 change submodule push test to use proper repository setupHeiko Voigt, Oct 6, 2017
  4. Stefan BellerOct 9, 2017
  5. Heiko VoigtOct 10, 2017
  6. Stefan BellerOct 10, 2017
  7. Junio C HamanoOct 10, 2017
  8. Stefan BellerOct 10, 2017
  9. Junio C HamanoOct 11, 2017
  10. Heiko VoigtOct 11, 2017
  11. Junio C HamanoOct 12, 2017
  12. Heiko VoigtOct 11, 2017
  13. Josh TriplettOct 11, 2017
  14. Brandon WilliamsOct 12, 2017
  15. 4/4 submodule: simplify decision tree whether to or not to fetchHeiko Voigt, Oct 6, 2017
  16. 3/4 implement fetching of moved submodulesHeiko Voigt, Oct 6, 2017
  17. Stefan BellerOct 6, 2017
  18. Junio C HamanoOct 7, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.