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

[RFC PATCH 1/4] fetch: add test to make sure we stay backwards compatible

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Oct 6, 2017, 22:30 UTC
Message-ID
<20171006223047.GB26642@sandbox>
In-Reply-To
<20171006222544.GA26642@sandbox>

The current implementation of submodules supports on-demand fetch if there is no .gitmodules entry for a submodule. Let's add a test to document this behavior.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 t/t5526-fetch-submodules.sh | 42 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 42251f7..43a22f6 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -478,7 +478,47 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
 		git fetch >../actual.out 2>../actual.err
 	) &&
 	! test -s actual.out &&
-	test_i18ncmp expect.err actual.err
+	test_i18ncmp expect.err actual.err &&
+	(
+		cd submodule &&
+		git checkout -q master
+	)
+'
+
+test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .gitmodule entry" '
+	(
+		cd downstream &&
+		git fetch --recurse-submodules
+	) &&
+	add_upstream_commit &&
+	head1=$(git rev-parse --short HEAD) &&
+	git add submodule &&
+	git rm .gitmodules &&
+	git commit -m "new submodule without .gitmodules" &&
+	printf "" >expect.out &&
+	head2=$(git rev-parse --short HEAD) &&
+	echo "From $pwd/." >expect.err.2 &&
+	echo "   $head1..$head2  master     -> origin/master" >>expect.err.2 &&
+	head -3 expect.err >>expect.err.2 &&
+	(
+		cd downstream &&
+		rm .gitmodules &&
+		git config fetch.recurseSubmodules on-demand &&
+		# fake submodule configuration to avoid skipping submodule handling
+		git config -f .gitmodules submodule.fake.path fake &&
+		git config -f .gitmodules submodule.fake.url fakeurl &&
+		git add .gitmodules &&
+		git config --unset submodule.submodule.url &&
+		git fetch >../actual.out 2>../actual.err &&
+		# cleanup
+		git config --unset fetch.recurseSubmodules &&
+		git reset --hard
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err.2 actual.err &&
+	git checkout HEAD^ -- .gitmodules &&
+	git add .gitmodules &&
+	git commit -m "new submodule restored .gitmodules"
 '
 
 test_expect_success 'fetching submodules respects parallel settings' '
-- 
2.10.0.129.g35f6318
Previous: Heiko VoigtNext: Heiko Voigt
Message 2 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.