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

[Outreachy PATCH 1/2] t0410: use rev-parse to get the subtree OID

From
DTDorine Tipo <dorine.a.tipo@gmail.com>
Date
Oct 14, 2026, 13:45 UTC
Message-ID
<20261014134504.1152225-2-dorine.a.tipo@gmail.com>
In-Reply-To
<20261014134504.1152225-1-dorine.a.tipo@gmail.com>

The 'rev-list stops traversal at missing and promised tree' test gets the OID of a_dir by piping 'git ls-tree' through grep, head and cut.

The pipeline goes against t/README which says not to pipe the output of a git command, since only the last command's exit code is kept. 'cut -b13-52' also assumes a 40-character SHA-1 name, so under SHA-256 TREE2 holds an abbreviated OID.

Use 'git rev-parse HEAD:a_dir' instead. It returns the full OID in a single command, the same way TREE is computed with 'git rev-parse foo^{tree}' just above.

Signed-off-by: Dorine Tipo <dorine.a.tipo@gmail.com>
---
 t/t0410-partial-clone.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 788e9a1631..a24b663f73 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -405,7 +405,7 @@ test_expect_success 'rev-list stops traversal at missing and promised tree' '
 	TREE=$(git -C repo rev-parse foo^{tree}) &&
 
 	# a tree referenced by HEAD^{tree} (tree referenced from tree)
-	TREE2=$(git -C repo ls-tree HEAD^{tree} | grep " tree " | head -1 | cut -b13-52) &&
+	TREE2=$(git -C repo rev-parse HEAD:a_dir) &&
 
 	promise_and_delete "$TREE" &&
 	promise_and_delete "$TREE2" &&
-- 
2.34.1
Previous: Dorine TipoNext: Junio C Hamano
Message 2 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.