From: Junio C Hamano Date: Wed, 25 Mar 2026 06:21:07 GMT Subject: [PATCH 04/11] t4032: make test "set -e" clean Message-ID: <20260325062114.2067946-5-gitster@pobox.com> In-Reply-To: <20260325062114.2067946-1-gitster@pobox.com> In order to catch mistakes like misspelling "test_expect_success", we would like to eventually be able to run our test suite with the "-e" option on. A few shell construct used in this test were not ready. Make them so. * "git config --unset VAR" can fail when VAR is not defined. * The author of "test -f X && run test that uses X" written here really wanted to say "if file X is there, then run the test", not "file X must exist and the test using it must succeed". The proper way to express it is to say "test ! -f X || use X". Signed-off-by: Junio C Hamano --- t/t4032-diff-inter-hunk-context.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t4032-diff-inter-hunk-context.sh b/t/t4032-diff-inter-hunk-context.sh index bada0cbd32..efcd863126 100755 --- a/t/t4032-diff-inter-hunk-context.sh +++ b/t/t4032-diff-inter-hunk-context.sh @@ -17,7 +17,7 @@ f() { t() { use_config= - git config --unset diff.interHunkContext + git config --unset diff.interHunkContext || : case $# in 4) hunks=$4; cmd="diff -U$3";; @@ -40,7 +40,7 @@ t() { test $(git $cmd $file | grep '^@@ ' | wc -l) = $hunks " - test -f $expected && + test ! -f $expected || test_expect_success "$label: check output" " git $cmd $file | grep -v '^index ' >actual && test_cmp $expected actual -- 2.53.0-886-g529cbd14ff