From: Gatla Vishweshwar Reddy Date: Mon, 06 Jul 2026 20:50:36 GMT Subject: [PATCH] t1410-reflog.sh: avoid suppressing git's exit code in pipelines Message-ID: <20260706205036.3453-1-gatlavishweshwarreddy26@gmail.com> Piping git commands directly to wc -l suppresses the exit code of git, hiding potential failures from the test suite. Capture the output to a temporary file first, then count the lines separately to preserve the exit code. Signed-off-by: Gatla Vishweshwar Reddy --- t/t1410-reflog.sh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index ce71f9a30a..397f94b039 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -244,8 +244,10 @@ test_expect_success 'delete' ' test_tick && git commit -m tiger C && - HEAD_entry_count=$(git reflog | wc -l) && - main_entry_count=$(git reflog show main | wc -l) && + git reflog >reflog_output && + HEAD_entry_count=$(wc -l reflog_main_output && + main_entry_count=$(wc -l output && test_line_count = $(($main_entry_count - 1)) output && - test $HEAD_entry_count = $(git reflog | wc -l) && + git reflog >reflog_output && + test $HEAD_entry_count = $(wc -l reflog_output && + test $(($HEAD_entry_count -1)) = $(wc -l reflog_main_output && + test $main_entry_count = $(wc -l reflog_output && + HEAD_entry_count=$(wc -l output && @@ -321,11 +330,15 @@ test_expect_success 'git reflog expire unknown reference' ' ' test_expect_success 'checkout should not delete log for packed ref' ' - test $(git reflog main | wc -l) = 4 && + git reflog main >reflog_output && + test $(wc -l reflog_output && + test $(wc -l