t/lib-t6000: refactor `name_from_description()` to not depend on Perl

The `name_from_description()` test helper uses Perl to munge a given description and convert it into a name. Refactor it to instead use a combination of sed(1) and tr(1) so that we drop PERL_TEST_HELPERS prerequisites in users of this library. 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:06 UTC de9eeabd7119afb6c6895e88cb76403c1ec8273a
3 files changed +6 -19
t/lib-t6000.sh
+6 -7
@@ -109,13 +109,12 @@ check_output () {
109 # All alphanums translated into -'s which are then compressed and stripped
110 # from front and back.
111 name_from_description () {
112 - perl -pe '
113 - s/[^A-Za-z0-9.]/-/g;
114 - s/-+/-/g;
115 - s/-$//;
116 - s/^-//;
117 - y/A-Z/a-z/;
118 - '
112 + sed \
113 + -e 's/[^A-Za-z0-9.]/-/g' \
114 + -e 's/--*/-/g' \
115 + -e 's/-$//' \
116 + -e 's/^-//' \
117 + -e 'y/A-Z/a-z/'
118 }
119
120
t/t6002-rev-list-bisect.sh
-6
@@ -7,12 +7,6 @@ test_description='Tests git rev-list --bisect functionality'
7 . ./test-lib.sh
8 . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
9
10 -if ! test_have_prereq PERL_TEST_HELPERS
11 -then
12 - skip_all='skipping rev-list bisect tests; Perl not available'
13 - test_done
14 -fi
15 -
10 # usage: test_bisection max-diff bisect-option head ^prune...
11 #
12 # e.g. test_bisection 1 --bisect l1 ^l0
t/t6003-rev-list-topo-order.sh
-6
@@ -8,12 +8,6 @@ test_description='Tests git rev-list --topo-order functionality'
8 . ./test-lib.sh
9 . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
10
11 -if ! test_have_prereq PERL_TEST_HELPERS
12 -then
13 - skip_all='skipping rev-list topo-order tests; Perl not available'
14 - test_done
15 -fi
16 -
11 list_duplicates()
12 {
13 "$@" | sort | uniq -d