Skip to content

Commit 9cd2044

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 f1a4a0e commit 9cd2044

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
@@ -509,24 +509,19 @@ EDITOR=:
509509
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
510510
# deriving from the command substitution clustered with the other
511511
# ones.
512-
unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
513-
my @env = keys %ENV;
514-
my $ok = join("|", qw(
515-
TRACE
516-
DEBUG
517-
TEST
518-
.*_TEST
519-
PROVE
520-
VALGRIND
521-
UNZIP
522-
PERF_
523-
CURL_VERBOSE
524-
TRACE_CURL
525-
BUILD_DIR
526-
));
527-
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
528-
print join("\n", @vars);
529-
')
512+
unset VISUAL EMAIL LANGUAGE $(env | sed -n \
513+
-e '/^GIT_TRACE/d' \
514+
-e '/^GIT_DEBUG/d' \
515+
-e '/^GIT_TEST/d' \
516+
-e '/^GIT_.*_TEST/d' \
517+
-e '/^GIT_PROVE/d' \
518+
-e '/^GIT_VALGRIND/d' \
519+
-e '/^GIT_UNZIP/d' \
520+
-e '/^GIT_PERF_/d' \
521+
-e '/^GIT_CURL_VERBOSE/d' \
522+
-e '/^GIT_TRACE_CURL/d' \
523+
-e '/^GIT_BUILD_DIR/d' \
524+
-e 's/^\(GIT_[^=]*\)=.*/\1/p')
530525
unset XDG_CACHE_HOME
531526
unset XDG_CONFIG_HOME
532527
unset GITPERLLIB

0 commit comments

Comments
 (0)