[PATCH 08/11] t9200: make test "set -e" clean
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 25, 2026, 06:21 UTC
- Message-ID
- <20260325062114.2067946-9-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 test uses the usual pattern, where it
cmd ... if test $? ...
expects cmd to be allowed to fail freely and we can act on its exit status, which is not possible under "set -e". Rewrite it using the common pattern:
status=0; cmd ... || status=$? if test $status ...
which means the same thing but does not fail under "set -e".
Signed-off-by: Junio C Hamano <gitster@pobox.com> --- t/t9200-git-cvsexportcommit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh index 14cbe96527..65ef1d7c82 100755 --- a/t/t9200-git-cvsexportcommit.sh +++ b/t/t9200-git-cvsexportcommit.sh @@ -11,8 +11,8 @@ if ! test_have_prereq PERL; then test_done fi -cvs >/dev/null 2>&1 -if test $? -ne 1 +status=0; cvs >/dev/null 2>&1 || status=$? +if test $status -ne 1 then skip_all='skipping git cvsexportcommit tests, cvs not found' test_done
-- 2.53.0-886-g529cbd14ff