Subject: [GSoC PATCH 12/16] t3701: avoid suppressing git's exit code

From: Trieu Huynh <[email-masked]>
Date: Sun, 29 Mar 2026 05:02:51 +0900

Update t3701-add-interactive.sh to redirect git-cmds output
to a temporary file instead of piping it directly to not hide
the exit code of git commands behind pipes, as a crash in git
might go unnoticed.

Signed-off-by: Trieu Huynh <[email-masked]>
---
 t/t3701-add-interactive.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 6e120a4001..a07db3b1aa 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -293,8 +293,10 @@ test_expect_success FILEMODE 'patch does not affect mode' '
 	echo content >>file &&
 	chmod +x file &&
 	printf "n\\ny\\n" | git add -p &&
-	git show :file | grep content &&
-	git diff file | grep "new mode"
+	git show :file >actual &&
+	test_grep content actual &&
+	git diff file >actual &&
+	test_grep "new mode" actual
 '
 
 test_expect_success FILEMODE 'stage mode but not hunk' '
@@ -302,8 +304,10 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
 	echo content >>file &&
 	chmod +x file &&
 	printf "y\\nn\\n" | git add -p &&
-	git diff --cached file | grep "new mode" &&
-	git diff          file | grep "+content"
+	git diff --cached file >actual &&
+	test_grep "new mode" actual &&
+	git diff          file >actual &&
+	test_grep "+content" actual
 '

-- 
2.43.0