Skip to content

Commit 3b9554e

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 0612f86 commit 3b9554e

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
@@ -499,24 +499,19 @@ EDITOR=:
499499
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
500500
# deriving from the command substitution clustered with the other
501501
# ones.
502-
unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
503-
my @env = keys %ENV;
504-
my $ok = join("|", qw(
505-
TRACE
506-
DEBUG
507-
TEST
508-
.*_TEST
509-
PROVE
510-
VALGRIND
511-
UNZIP
512-
PERF_
513-
CURL_VERBOSE
514-
TRACE_CURL
515-
BUILD_DIR
516-
));
517-
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
518-
print join("\n", @vars);
519-
')
502+
unset VISUAL EMAIL LANGUAGE $(env | sed -n \
503+
-e '/^GIT_TRACE/d' \
504+
-e '/^GIT_DEBUG/d' \
505+
-e '/^GIT_TEST/d' \
506+
-e '/^GIT_.*_TEST/d' \
507+
-e '/^GIT_PROVE/d' \
508+
-e '/^GIT_VALGRIND/d' \
509+
-e '/^GIT_UNZIP/d' \
510+
-e '/^GIT_PERF_/d' \
511+
-e '/^GIT_CURL_VERBOSE/d' \
512+
-e '/^GIT_TRACE_CURL/d' \
513+
-e '/^GIT_BUILD_DIR/d' \
514+
-e 's/^\(GIT_[^=]*\)=.*/\1/p')
520515
unset XDG_CACHE_HOME
521516
unset XDG_CONFIG_HOME
522517
unset GITPERLLIB

0 commit comments

Comments
 (0)