]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t: skip chain lint when PERL_PATH is unset
authorPatrick Steinhardt <ps@pks.im>
Thu, 3 Apr 2025 05:05:52 +0000 (07:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Apr 2025 21:47:36 +0000 (14:47 -0700)
Our chainlint script verifies that test files have proper '&&' chains.
This script is written in Perl and executed for every test file before
executing the test logic itself.

In subsequent commits we're about to refactor our test suite so that
Perl becomes an optional dependency, only. And while it is already
possible to disable this linter, developers that don't have Perl
available at all would always have to disable the linter manually, which
is rather cumbersome.

Disable the chain linter automatically in case PERL_PATH isn't set to
make this a bit less annoying. Bail out with an error in case the
developer has asked explicitly for the chain linter.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh

index 9001ed3a6470a2b4d1ab27c4f26f35f356256fbe..1ce3b32fcac941df2a722f31f32db2b292c163ff 100644 (file)
@@ -1523,6 +1523,22 @@ then
        export LSAN_OPTIONS
 fi
 
+if test -z "$PERL_PATH"
+then
+       case "${GIT_TEST_CHAIN_LINT:-unset}" in
+       unset)
+               GIT_TEST_CHAIN_LINT=0
+               ;;
+       0)
+               # The user has explicitly disabled the chain linter, so we
+               # don't have anything to worry about.
+               ;;
+       *)
+               BAIL_OUT 'You need Perl for the chain linter'
+               ;;
+       esac
+fi
+
 if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 &&
    test "${GIT_TEST_EXT_CHAIN_LINT:-1}" != 0
 then