Git development
 help / color / mirror / Atom feed
* [Outreachy PATCH] t2104: avoid suppressing git's exit code
@ 2026-10-21  3:37 Cynthia Uche
  2026-10-21  8:00 ` Patrick Steinhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Cynthia Uche @ 2026-10-21  3:37 UTC (permalink / raw)
  To: git
  Cc: christian.couder, usmanakinyemi202, siddharthasthana31,
	kaartic.sivaraam, Cynthia Uche

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy PATCH] t2104: avoid suppressing git's exit code
  2026-10-21  3:37 [Outreachy PATCH] t2104: avoid suppressing git's exit code Cynthia Uche
@ 2026-10-21  8:00 ` Patrick Steinhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick Steinhardt @ 2026-10-21  8:00 UTC (permalink / raw)
  To: Cynthia Uche
  Cc: git, christian.couder, usmanakinyemi202, siddharthasthana31,
	kaartic.sivaraam

On Wed, Oct 21, 2026 at 04:37:23AM +0100, Cynthia Uche wrote:
> 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.

Makes sense, and the patch looks obviously good to me, too. Thanks!

Patrick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-21  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21  3:37 [Outreachy PATCH] t2104: avoid suppressing git's exit code Cynthia Uche
2026-10-21  8:00 ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox