Skip to content

Commit acfba9a

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 d56e4b3 commit acfba9a

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
@@ -107,23 +107,18 @@ EDITOR=:
107107
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
108108
# deriving from the command substitution clustered with the other
109109
# ones.
110-
unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
111-
my @env = keys %ENV;
112-
my $ok = join("|", qw(
113-
TRACE
114-
DEBUG
115-
TEST
116-
.*_TEST
117-
PROVE
118-
VALGRIND
119-
UNZIP
120-
PERF_
121-
CURL_VERBOSE
122-
TRACE_CURL
123-
));
124-
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
125-
print join("\n", @vars);
126-
')
110+
unset VISUAL EMAIL LANGUAGE COLUMNS $(env | sed -n \
111+
-e '/^GIT_TRACE/d' \
112+
-e '/^GIT_DEBUG/d' \
113+
-e '/^GIT_TEST/d' \
114+
-e '/^GIT_.*_TEST/d' \
115+
-e '/^GIT_PROVE/d' \
116+
-e '/^GIT_VALGRIND/d' \
117+
-e '/^GIT_UNZIP/d' \
118+
-e '/^GIT_PERF_/d' \
119+
-e '/^GIT_CURL_VERBOSE/d' \
120+
-e '/^GIT_TRACE_CURL/d' \
121+
-e 's/^\(GIT_[^=]*\)=.*/\1/p')
127122
unset XDG_CACHE_HOME
128123
unset XDG_CONFIG_HOME
129124
unset GITPERLLIB

0 commit comments

Comments
 (0)