Skip to content

Commit cb29761

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 1fa7c9b commit cb29761

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
@@ -468,23 +468,18 @@ EDITOR=:
468468
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
469469
# deriving from the command substitution clustered with the other
470470
# ones.
471-
unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
472-
my @env = keys %ENV;
473-
my $ok = join("|", qw(
474-
TRACE
475-
DEBUG
476-
TEST
477-
.*_TEST
478-
PROVE
479-
VALGRIND
480-
UNZIP
481-
PERF_
482-
CURL_VERBOSE
483-
TRACE_CURL
484-
));
485-
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
486-
print join("\n", @vars);
487-
')
471+
unset VISUAL EMAIL LANGUAGE $(env | sed -n \
472+
-e '/^GIT_TRACE/d' \
473+
-e '/^GIT_DEBUG/d' \
474+
-e '/^GIT_TEST/d' \
475+
-e '/^GIT_.*_TEST/d' \
476+
-e '/^GIT_PROVE/d' \
477+
-e '/^GIT_VALGRIND/d' \
478+
-e '/^GIT_UNZIP/d' \
479+
-e '/^GIT_PERF_/d' \
480+
-e '/^GIT_CURL_VERBOSE/d' \
481+
-e '/^GIT_TRACE_CURL/d' \
482+
-e 's/^\(GIT_[^=]*\)=.*/\1/p')
488483
unset XDG_CACHE_HOME
489484
unset XDG_CONFIG_HOME
490485
unset GITPERLLIB

0 commit comments

Comments
 (0)