]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/lib-t6000: refactor `name_from_description()` to not depend on Perl
authorPatrick Steinhardt <ps@pks.im>
Thu, 3 Apr 2025 05:06:06 +0000 (07:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Apr 2025 21:47:40 +0000 (14:47 -0700)
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>
t/lib-t6000.sh
t/t6002-rev-list-bisect.sh
t/t6003-rev-list-topo-order.sh

index fba6778ca35a2022513c8b36434fc24825e875c2..35c547246506f51582a67326643c7133dbe223c0 100644 (file)
@@ -109,13 +109,12 @@ check_output () {
 # All alphanums translated into -'s which are then compressed and stripped
 # from front and back.
 name_from_description () {
-       perl -pe '
-               s/[^A-Za-z0-9.]/-/g;
-               s/-+/-/g;
-               s/-$//;
-               s/^-//;
-               y/A-Z/a-z/;
-       '
+       sed \
+               -e 's/[^A-Za-z0-9.]/-/g' \
+               -e 's/--*/-/g' \
+               -e 's/-$//' \
+               -e 's/^-//' \
+               -e 'y/A-Z/a-z/'
 }
 
 
index 5e1482aff78d2b4cae3e988e939532099b9f032d..daa009c9a1b4b67d510df74f1d5d5cc2b1a904cd 100755 (executable)
@@ -7,12 +7,6 @@ test_description='Tests git rev-list --bisect functionality'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
 
-if ! test_have_prereq PERL_TEST_HELPERS
-then
-       skip_all='skipping rev-list bisect tests; Perl not available'
-       test_done
-fi
-
 # usage: test_bisection max-diff bisect-option head ^prune...
 #
 # e.g. test_bisection 1 --bisect l1 ^l0
index 02dd4127aff552454f0a94ddc56e721a50dbddc9..0d7055d46d46906af535032071c33ac353b54e90 100755 (executable)
@@ -8,12 +8,6 @@ test_description='Tests git rev-list --topo-order functionality'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
 
-if ! test_have_prereq PERL_TEST_HELPERS
-then
-       skip_all='skipping rev-list topo-order tests; Perl not available'
-       test_done
-fi
-
 list_duplicates()
 {
     "$@" | sort | uniq -d