Skip to content

Commit 01c8c0a

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 c67d95d commit 01c8c0a

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

t/test-lib.sh

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -382,24 +382,19 @@ fi
382382
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
383383
# deriving from the command substitution clustered with the other
384384
# ones.
385-
unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
386-
my @env = keys %ENV;
387-
my $ok = join("|", qw(
388-
TRACE
389-
TR2_
390-
DEBUG
391-
TEST
392-
.*_TEST
393-
PROVE
394-
VALGRIND
395-
UNZIP
396-
PERF_
397-
CURL_VERBOSE
398-
TRACE_CURL
399-
));
400-
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
401-
print join("\n", @vars);
402-
')
385+
unset VISUAL EMAIL LANGUAGE COLUMNS $(env | sed -n \
386+
-e '/^GIT_TRACE/d' \
387+
-e '/^GIT_TR2_/d' \
388+
-e '/^GIT_DEBUG/d' \
389+
-e '/^GIT_TEST/d' \
390+
-e '/^GIT_.*_TEST/d' \
391+
-e '/^GIT_PROVE/d' \
392+
-e '/^GIT_VALGRIND/d' \
393+
-e '/^GIT_UNZIP/d' \
394+
-e '/^GIT_PERF_/d' \
395+
-e '/^GIT_CURL_VERBOSE/d' \
396+
-e '/^GIT_TRACE_CURL/d' \
397+
-e 's/^\(GIT_[^=]*\)=.*/\1/p')
403398
unset XDG_CACHE_HOME
404399
unset XDG_CONFIG_HOME
405400
unset GITPERLLIB

0 commit comments

Comments
 (0)