Skip to content

Commit 095befd

Browse files
committed
test-lib: avoid unnecessary Perl invocation
It is a bit strange, and even undesirable, to require Perl just to run the test suite even when NO_PERL was set. This patch does not fix this problem by any stretch of imagination. However, it fixes *the* Perl invocation that *every single* test script has to run. While at it, it makes the source code also more grep'able, as the code that unsets some, but not all, GIT_* environment variables just became a *lot* more explicit. And all that while still reducing the total number of lines. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 83ffa9e commit 095befd

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

t/test-lib.sh

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,18 @@ fi
119119
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
120120
# deriving from the command substitution clustered with the other
121121
# ones.
122-
unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
123-
my @env = keys %ENV;
124-
my $ok = join("|", qw(
125-
TRACE
126-
DEBUG
127-
TEST
128-
.*_TEST
129-
PROVE
130-
VALGRIND
131-
UNZIP
132-
PERF_
133-
CURL_VERBOSE
134-
TRACE_CURL
135-
));
136-
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
137-
print join("\n", @vars);
138-
')
122+
unset VISUAL EMAIL LANGUAGE COLUMNS $(env | sed -n \
123+
-e '/^GIT_TRACE/d' \
124+
-e '/^GIT_DEBUG/d' \
125+
-e '/^GIT_TEST/d' \
126+
-e '/^GIT_.*_TEST/d' \
127+
-e '/^GIT_PROVE/d' \
128+
-e '/^GIT_VALGRIND/d' \
129+
-e '/^GIT_UNZIP/d' \
130+
-e '/^GIT_PERF_/d' \
131+
-e '/^GIT_CURL_VERBOSE/d' \
132+
-e '/^GIT_TRACE_CURL/d' \
133+
-e 's/^\(GIT_[^=]*\)=.*/\1/p')
139134
unset XDG_CACHE_HOME
140135
unset XDG_CONFIG_HOME
141136
unset GITPERLLIB

0 commit comments

Comments
 (0)