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

[PATCH] t0100: avoid suppressing git exit code

From
amisha <amishhhaaaa@gmail.com>
Date
Jan 13, 2026, 18:04 UTC
Message-ID
<20260113180409.36683-1-amishhhaaaa@gmail.com>

In t0100-previous.sh, the exit code of 'git cat-file' is suppressed by piping it directly into grep. If git crashes, the test might not notice.

Redirect the output of git to a temporary file 'actual' and grep from that file instead. This ensures that the exit code of the git command is properly checked.

Signed-off-by: amisha <amishhhaaaa@gmail.com>
---
 t/t0100-previous.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/t0100-previous.sh b/t/t0100-previous.sh
index dd5d9b4e5e..ffe3fda495 100755
--- a/t/t0100-previous.sh
+++ b/t/t0100-previous.sh
@@ -40,7 +40,8 @@ test_expect_success 'merge @{-1}' '
 	git checkout other &&
 	git checkout main &&
 	git merge @{-1} &&
-	git cat-file commit HEAD | grep "Merge branch '\''other'\''"
+	git cat-file commit HEAD >actual &&
+	grep "Merge branch '\''other'\''" actual
 '
 
 test_expect_success 'merge @{-1}~1' '
-- 
2.51.0
Next: Pushkar Singh
Message 1 of 2 in “t0100: avoid suppressing git exit code”
  1. t0100: avoid suppressing git exit codeamisha, Jan 13, 2026
  2. Pushkar SinghJan 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.