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

[Outreachy PATCH v2 2/2] t0410: keep git's exit code in test_grep calls

From
DTDorine Tipo <dorine.a.tipo@gmail.com>
Date
Oct 20, 2026, 16:01 UTC
Message-ID
<20261020160127.29096-3-dorine.a.tipo@gmail.com>
In-Reply-To
<20261020160127.29096-1-dorine.a.tipo@gmail.com>

The 'rev-list stops traversal at missing and promised tree' test passes "$(git -C repo rev-parse ...)" directly to test_grep. t/README says not to use command substitution in a way that discards git's exit code: the && chain only sees test_grep's exit code, so a failure in git is not caught there.

Assign the rev-parse output to variables first and pass those to test_grep instead.

Signed-off-by: Dorine Tipo <dorine.a.tipo@gmail.com>
---
 t/t0410-partial-clone.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index a24b663f73..57da830105 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -413,9 +413,13 @@ test_expect_success 'rev-list stops traversal at missing and promised tree' '
 	git -C repo config core.repositoryformatversion 1 &&
 	git -C repo config extensions.partialclone "arbitrary string" &&
 	git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
-	test_grep $(git -C repo rev-parse foo) out &&
+
+	FOO=$(git -C repo rev-parse foo) &&
+	HEAD_OID=$(git -C repo rev-parse HEAD) &&
+
+	test_grep "$FOO" out &&
 	test_grep ! $TREE out &&
-	test_grep $(git -C repo rev-parse HEAD) out &&
+	test_grep "$HEAD_OID" out &&
 	test_grep ! $TREE2 out
 '
 
-- 
2.34.1
Previous: Laveesh BansalNext: Laveesh Bansal
Message 9 of 10 in “t0410: fix exit code and hash assumptions in the missing-tree test”
  1. 0/2 t0410: fix exit code and hash assumptions in the missing-tree testDorine Tipo, Oct 14, 2026
  2. 1/2 t0410: use rev-parse to get the subtree OIDDorine Tipo, Oct 14, 2026
  3. Junio C HamanoOct 14, 2026
  4. Dorine TipoOct 15, 2026
  5. 2/2 t0410: keep git's exit code in test_grep callsDorine Tipo, Oct 14, 2026
  6. 0/2 t0410: fix exit code and hash assumptions in the missing-tree testDorine Tipo, Oct 20, 2026
  7. 1/2 t0410: use rev-parse to get the subtree OIDDorine Tipo, Oct 20, 2026
  8. Laveesh BansalNov 14, 2026
  9. 2/2 t0410: keep git's exit code in test_grep callsDorine Tipo, Oct 20, 2026
  10. Laveesh BansalNov 14, 2026

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.