t: skip chain lint when PERL_PATH is unset

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>

Patrick Steinhardt committed Apr 3, 2025 at 07:05 UTC 8afecde5275f689bcbfb508aa47241dd7ecdf884
1 file changed +16
t/test-lib.sh
+16
@@ -1523,6 +1523,22 @@ then
1523 export LSAN_OPTIONS
1524 fi
1525
1526 +if test -z "$PERL_PATH"
1527 +then
1528 + case "${GIT_TEST_CHAIN_LINT:-unset}" in
1529 + unset)
1530 + GIT_TEST_CHAIN_LINT=0
1531 + ;;
1532 + 0)
1533 + # The user has explicitly disabled the chain linter, so we
1534 + # don't have anything to worry about.
1535 + ;;
1536 + *)
1537 + BAIL_OUT 'You need Perl for the chain linter'
1538 + ;;
1539 + esac
1540 +fi
1541 +
1542 if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 &&
1543 test "${GIT_TEST_EXT_CHAIN_LINT:-1}" != 0
1544 then