Thread (2 messages) 2 messages, 2 authors, 2026-01-14
STALE162d

[PATCH] t0100: avoid suppressing git exit code

From: amisha <hidden>
Date: 2026-01-13 18:04:20
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help