[PATCH] t0008: make test "set -e" clean
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 24, 2026, 18:20 UTC
- Message-ID
- <xmqqh5q5ytq0.fsf_-_@gitster.g>
- In-Reply-To
- <xmqqcy0t178a.fsf_-_@gitster.g>
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 piece of script used "grep" to filter out its input purely for its output, but of course, "grep" reports with its exit value when it did not see any hits, which didn't mesh quite well with "set -e".
Signed-off-by: Junio C Hamano <gitster@pobox.com> --- t/t0008-ignores.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git i/t/t0008-ignores.sh w/t/t0008-ignores.sh index db8bde280e..8edb08d9c2 100755 --- i/t/t0008-ignores.sh +++ w/t/t0008-ignores.sh @@ -122,7 +122,7 @@ test_expect_success_multiple () { fi testname="$1" expect_all="$2" code="$3" - expect_verbose=$( echo "$expect_all" | grep -v '^:: ' ) + expect_verbose=$( echo "$expect_all" | grep -v '^:: ' ) || : expect=$( echo "$expect_verbose" | sed -e 's/.* //' ) test_expect_success $prereq "$testname${no_index_opt:+ with $no_index_opt}" '