From: Trieu Huynh Date: Sat, 28 Mar 2026 20:02:51 GMT Subject: [GSoC PATCH 12/16] t3701: avoid suppressing git's exit code Message-ID: <20260328200255.247759-13-vikingtc4@gmail.com> In-Reply-To: <20260328200255.247759-1-vikingtc4@gmail.com> 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 --- 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