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

[Outreachy PATCH] t2104: avoid suppressing git's exit code

From
CUCynthia Uche <herroyalpriestess@gmail.com>
Date
Oct 21, 2026, 03:37 UTC
Message-ID
<20261021033723.5265-1-herroyalpriestess@gmail.com>

The exit code of the upstream command in a pipeline is lost, so a crash in 'git ls-files' would go unnoticed. Write the output to a file and compare that instead.

Signed-off-by: Cynthia Uche <herroyalpriestess@gmail.com>
---
 t/t2104-update-index-skip-worktree.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/t/t2104-update-index-skip-worktree.sh b/t/t2104-update-index-skip-worktree.sh
index 7a0778ed98..68a4339e24 100755
--- a/t/t2104-update-index-skip-worktree.sh
+++ b/t/t2104-update-index-skip-worktree.sh
@@ -34,7 +34,8 @@ test_expect_success 'setup' '
 	mkdir sub &&
 	touch ./1 ./2 sub/1 sub/2 &&
 	git add 1 2 sub/1 sub/2 &&
-	git ls-files -t | test_cmp expect.full -
+	git ls-files -t >actual &&
+	test_cmp expect.full actual
 '
 
 test_expect_success 'index is at version 2' '
@@ -43,7 +44,8 @@ test_expect_success 'index is at version 2' '
 
 test_expect_success 'update-index --skip-worktree' '
 	git update-index --skip-worktree 1 sub/1 &&
-	git ls-files -t | test_cmp expect.skip -
+	git ls-files -t >actual &&
+	test_cmp expect.skip actual
 '
 
 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
@@ -51,12 +53,14 @@ test_expect_success 'index is at version 3 after having some skip-worktree entri
 '
 
 test_expect_success 'ls-files -t' '
-	git ls-files -t | test_cmp expect.skip -
+	git ls-files -t >actual &&
+	test_cmp expect.skip actual
 '
 
 test_expect_success 'update-index --no-skip-worktree' '
 	git update-index --no-skip-worktree 1 sub/1 &&
-	git ls-files -t | test_cmp expect.full -
+	git ls-files -t >actual &&
+	test_cmp expect.full actual
 '
 
 test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
-- 
2.56.GIT
Next: Patrick Steinhardt
Message 1 of 4 in “t2104: avoid suppressing git's exit code”
  1. t2104: avoid suppressing git's exit codeCynthia Uche, Oct 21, 2026
  2. Patrick SteinhardtOct 21, 2026
  3. PriestessOct 22, 2026
  4. Junio C HamanoOct 23, 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.