Subject: [PATCH 06/11] tests: make svn test "set -e" clean

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Mar 2026 23:21:09 -0700

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.

The git-svn helper scriptlet suffers from two instances of the
recurring pattern where a sequence

	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".

As the second instance uses an extra variable $x to capture the
status of the failed command already, let's use that variable to
rewrite the above pattern to

	x=0; cmd ... || x=$?
	if test $x ...

which means the same thing but does not fail under "set -e".

Signed-off-by: Junio C Hamano <[email-masked]>
---
 t/lib-git-svn.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 2fde2353fd..a73b997f8f 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -15,8 +15,8 @@ GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn
 SVN_TREE=$GIT_SVN_DIR/svn-tree
 test_set_port SVNSERVE_PORT
 
-svn >/dev/null 2>&1
-if test $? -ne 1
+x=0; svn >/dev/null 2>&1 || x=$?
+if test $x -ne 1
 then
 	skip_all='skipping git svn tests, svn not found'
 	test_done
@@ -32,8 +32,7 @@ use SVN::Core;
 use SVN::Repos;
 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
 system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41);
-" >&3 2>&4
-x=$?
+" >&3 2>&4 || x=$?
 if test $x -ne 0
 then
 	if test $x -eq 42; then
-- 
2.53.0-886-g529cbd14ff