userdiff: add a builtin pattern for dts files
[gitweb.git] / t / test-lib.sh
index ed5d69dfe5144fe7a6c85ad2541ba44b0e530f5c..30b07e310f59493616f766ea6cf7c45a335c9258 100644 (file)
@@ -386,7 +386,6 @@ unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
        my @env = keys %ENV;
        my $ok = join("|", qw(
                TRACE
-               TR2_
                DEBUG
                TEST
                .*_TEST
@@ -1389,6 +1388,25 @@ yes () {
        done
 }
 
+# The GIT_TEST_FAIL_PREREQS code hooks into test_set_prereq(), and
+# thus needs to be set up really early, and set an internal variable
+# for convenience so the hot test_set_prereq() codepath doesn't need
+# to call "git env--helper". Only do that work if needed by seeing if
+# GIT_TEST_FAIL_PREREQS is set at all.
+GIT_TEST_FAIL_PREREQS_INTERNAL=
+if test -n "$GIT_TEST_FAIL_PREREQS"
+then
+       if git env--helper --type=bool --default=0 --exit-code GIT_TEST_FAIL_PREREQS
+       then
+               GIT_TEST_FAIL_PREREQS_INTERNAL=true
+               test_set_prereq FAIL_PREREQS
+       fi
+else
+       test_lazy_prereq FAIL_PREREQS '
+               git env--helper --type=bool --default=0 --exit-code GIT_TEST_FAIL_PREREQS
+       '
+fi
+
 # Fix some commands on Windows
 uname_s=$(uname -s)
 case $uname_s in
@@ -1605,7 +1623,3 @@ test_lazy_prereq SHA1 '
 test_lazy_prereq REBASE_P '
        test -z "$GIT_TEST_SKIP_REBASE_P"
 '
-
-test_lazy_prereq FAIL_PREREQS '
-       test -n "$GIT_TEST_FAIL_PREREQS"
-'