[PATCH 11/11] t9902: make test "set -e" clean
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 25, 2026, 06:21 UTC
- Message-ID
- <20260325062114.2067946-12-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.
This script uses the "read" utility to populate a single variable with the contents of a here-document. As "read" signals that it saw the EOF by exiting with status 1, this triggers "set -e".
Here, we squelch it with the standard "|| :" trick. A simpler alternative may be to use a simpler assignment, e.g.,
refs='main
maint
next
seen'Either way would work, but just honor the original author's preference.
Signed-off-by: Junio C Hamano <gitster@pobox.com> --- t/t9902-completion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 2f9a597ec7..e3a7df7691 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -590,7 +590,7 @@ test_expect_success '__gitcomp - doesnt fail because of invalid variable name' ' __gitcomp "$invalid_variable_name" ' -read -r -d "" refs <<-\EOF +read -r -d "" refs <<-\EOF || : main maint next
-- 2.53.0-886-g529cbd14ff