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

[PATCH v3 1/2] t7415: don't bother creating commit for symlink test

From
Jeff King <peff@peff.net>
Date
Jun 11, 2018, 08:35 UTC
Message-ID
<20180611083540.GA16131@sigill.intra.peff.net>
In-Reply-To
<20180611083515.GA1815@sigill.intra.peff.net>

Early versions of the fsck .gitmodules detection code actually required a tree to be at the root of a commit for it to be checked for .gitmodules. What we ended up with in 159e7b080b (fsck: detect gitmodules files, 2018-05-02), though, finds a .gitmodules file in _any_ tree (see that commit for more discussion).

As a result, there's no need to create a commit in our tests. Let's drop it in the name of simplicity. And since that was the only thing referencing $tree, we can pull our tree creation out of a command substitution.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t7415-submodule-names.sh | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/t/t7415-submodule-names.sh b/t/t7415-submodule-names.sh
index a770d92a55..541bd81684 100755
--- a/t/t7415-submodule-names.sh
+++ b/t/t7415-submodule-names.sh
@@ -135,13 +135,10 @@ test_expect_success 'fsck detects symlinked .gitmodules file' '
 		tricky="[foo]bar=true" &&
 		content=$(git hash-object -w ../.gitmodules) &&
 		target=$(printf "$tricky" | git hash-object -w --stdin) &&
-		tree=$(
-			{
-				printf "100644 blob $content\t$tricky\n" &&
-				printf "120000 blob $target\t.gitmodules\n"
-			} | git mktree
-		) &&
-		commit=$(git commit-tree $tree) &&
+		{
+			printf "100644 blob $content\t$tricky\n" &&
+			printf "120000 blob $target\t.gitmodules\n"
+		} | git mktree &&
 
 		# Check not only that we fail, but that it is due to the
 		# symlink detector; this grep string comes from the config
-- 
2.18.0.rc1.446.g4486251e51
Previous: Jeff KingNext: Jeff King
Message 14 of 17 in “fsck: avoid looking at NULL blob->object”
  1. fsck: avoid looking at NULL blob->objectJeff King, Jun 9, 2018
  2. Eric SunshineJun 9, 2018
  3. Jeff KingJun 9, 2018
  4. Duy NguyenJun 9, 2018
  5. Jeff KingJun 9, 2018
  6. Martin ÅgrenJun 9, 2018
  7. Jeff KingJun 9, 2018
  8. Martin ÅgrenJun 9, 2018
  9. Jeff KingJun 12, 2018
  10. 0/2 .gitmodules fsck cleanupsJeff King, Jun 9, 2018
  11. 1/2 t7415: don't bother creating commit for symlink testJeff King, Jun 9, 2018
  12. SZEDER GáborJun 9, 2018
  13. 0/2 .gitmodules fsck cleanupsJeff King, Jun 11, 2018
  14. 1/2 t7415: don't bother creating commit for symlink testJeff King, Jun 11, 2018
  15. 2/2 fsck: avoid looking at NULL blob->objectJeff King, Jun 11, 2018
  16. 2/2 fsck: avoid looking at NULL blob->objectJeff King, Jun 9, 2018
  17. SZEDER GáborJun 9, 2018

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.