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

[PATCH] t7400: testcase for submodule status on unregistered inner git repos

From
PKPeter Kaestle <peter@piie.net>
Date
Feb 2, 2020, 23:32 UTC
Message-ID
<20200202233244.199040-1-peter@piie.net>
In-Reply-To
<xmqqzhe8bwab.fsf@gitster-ct.c.googlers.com>

We have test coverage for "git submodule status" output in various cases, i.e.

  1) not-init, not-cloned: status should initially be "missing"
  2) init, not-cloned: status should be "missing"
  3) not-init, cloned: status should ignore the inner git-repo
  4) init, cloned: status should be "up-to-date" after update
  4.1) + modified: status should be "modified" after submodule commit
  4.2) + modified, committed: status should be "up-to-date" after update
the case 3) is not covered yet.

Test that submodule status reports an inner git repo as unknown, while it is not added to the superproject. This covers case (3).

Signed-off-by: Peter Kaestle <peter@piie.net>
---
 t/t7400-submodule-basic.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 29dc6812f1..d926b8c772 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -55,6 +55,21 @@ test_expect_success 'add aborts on repository with no commits' '
 	test_i18ncmp expect actual
 '
 
+test_expect_success 'status should ignore inner git repo when not added' '
+	rm -fr inner &&
+	mkdir inner &&
+	(
+		cd inner &&
+		git init &&
+		>t &&
+		git add t &&
+		git commit -m "initial"
+	) &&
+	test_must_fail git submodule status inner 2>output.err &&
+	rm -fr inner &&
+	test_i18ngrep "^error: .*did not match any file(s) known to git" output.err
+'
+
 test_expect_success 'setup - repository in init subdirectory' '
 	mkdir init &&
 	(
-- 
2.25.0
Previous: Peter KästleNext: Peter Kästle
Message 11 of 16 in “Fix submodule status of dirs initialized but empty”
  1. Fix submodule status of dirs initialized but emptyPeter Kästle, Jan 14, 2020
  2. Fix status of initialized but not cloned submodulesPeter Kaestle, Jan 21, 2020
  3. Junio C HamanoJan 23, 2020
  4. 1/2 Testcase for submodule status on empty dirsPeter Kaestle, Jan 24, 2020
  5. 2/2 Fix status of initialized but not cloned submodulesPeter Kaestle, Jan 24, 2020
  6. Junio C HamanoJan 24, 2020
  7. 1/2 t7400: add a testcase for submodule status on empty dirsPeter Kaestle, Jan 27, 2020
  8. 2/2 Fix status of initialized but not cloned submodulesPeter Kaestle, Jan 27, 2020
  9. Junio C HamanoJan 27, 2020
  10. Peter KästleJan 28, 2020
  11. t7400: testcase for submodule status on unregistered inner git reposPeter Kaestle, Feb 2, 2020
  12. Peter KästleJan 24, 2020
  13. Junio C HamanoJan 24, 2020
  14. Peter KästleJan 27, 2020
  15. Junio C HamanoJan 27, 2020
  16. Peter KästleFeb 2, 2020

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.