t: refactor environment sanitization to not use Perl
Before executing tests we first sanitize the environment. Part of the sanitization is to unset a couple of environment variables that we know will change the behaviour of Git. This is done with a small Perl script, which has the consequence that having a Perl interpreter available is a strict requirement for running our unit tests. The logic itself isn't particularly involved: we simply unset every environment variable whose key starts with 'GIT_', but then explicitly allow a subset of these. Refactor the logic to instead use sed(1) so that it becomes possible to execute our tests without Perl. Based-on-patch-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
8afecde527
commit
7792d326f1
|
@ -499,24 +499,20 @@ EDITOR=:
|
||||||
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
|
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
|
||||||
# deriving from the command substitution clustered with the other
|
# deriving from the command substitution clustered with the other
|
||||||
# ones.
|
# ones.
|
||||||
unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
|
unset VISUAL EMAIL LANGUAGE $(env | sed -n \
|
||||||
my @env = keys %ENV;
|
-e '/^GIT_TRACE/d' \
|
||||||
my $ok = join("|", qw(
|
-e '/^GIT_DEBUG/d' \
|
||||||
TRACE
|
-e '/^GIT_TEST/d' \
|
||||||
DEBUG
|
-e '/^GIT_.*_TEST/d' \
|
||||||
TEST
|
-e '/^GIT_PROVE/d' \
|
||||||
.*_TEST
|
-e '/^GIT_VALGRIND/d' \
|
||||||
PROVE
|
-e '/^GIT_UNZIP/d' \
|
||||||
VALGRIND
|
-e '/^GIT_PERF_/d' \
|
||||||
UNZIP
|
-e '/^GIT_CURL_VERBOSE/d' \
|
||||||
PERF_
|
-e '/^GIT_TRACE_CURL/d' \
|
||||||
CURL_VERBOSE
|
-e '/^GIT_BUILD_DIR/d' \
|
||||||
TRACE_CURL
|
-e 's/^\(GIT_[^=]*\)=.*/\1/p'
|
||||||
BUILD_DIR
|
)
|
||||||
));
|
|
||||||
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
|
|
||||||
print join("\n", @vars);
|
|
||||||
')
|
|
||||||
unset XDG_CACHE_HOME
|
unset XDG_CACHE_HOME
|
||||||
unset XDG_CONFIG_HOME
|
unset XDG_CONFIG_HOME
|
||||||
unset GITPERLLIB
|
unset GITPERLLIB
|
||||||
|
|
Loading…
Reference in New Issue