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

[PATCH] t/perf/p5304: catch git count-objects failures

From
SSanthosh <santhoshprogrammer07@gmail.com>
Date
Mar 1, 2026, 02:22 UTC
Message-ID
<20260301022253.129736-1-santhoshprogrammer07@gmail.com>

Piping `git count-objects` into `grep` masks the exit code of the git command. If `count-objects` fails but `grep` succeeds, the pipeline reports success, potentially hiding bugs.

Write the output to a temporary file instead to ensure the exit code of the git command is properly evaluated.

Signed-off-by: Santhosh <santhoshprogrammer07@gmail.com>
---
 t/perf/p5304-prune.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/perf/p5304-prune.sh b/t/perf/p5304-prune.sh
index 83baedb8a4..af59424de8 100755
--- a/t/perf/p5304-prune.sh
+++ b/t/perf/p5304-prune.sh
@@ -14,7 +14,7 @@ test_expect_success 'remove unreachable loose objects' '
 '
 
 test_expect_success 'confirm there are no loose objects' '
-	git count-objects | grep ^0
+	git count-objects >out && grep ^0 out
 '
 
 test_perf 'prune with no objects' '
-- 
2.43.0
Message 1 of 1 in “t/perf/p5304: catch git count-objects failures”
  1. t/perf/p5304: catch git count-objects failuresSanthosh, Mar 1, 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.