t5703: refactor test to not depend on Perl
We use Perl due to two different reasons in t5703: - To filter advertised capabilities. - To set up a CGI script with HTTPD. Refactor the first category to use `test_grep` instead. Refactoring the second category would be a bit more involved, so instead we add the PERL_TEST_HELPERS prerequisite to those individual tests now. 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
7a7b6022670c7946afea73a1eeb2ddc32d756624
1 file changed
+8
-17
t/t5703-upload-pack-ref-in-want.sh
+8
-17
@@ -4,12 +4,6 @@ test_description='upload-pack ref-in-want'
4
5
. ./test-lib.sh
6
7
-if ! test_have_prereq PERL_TEST_HELPERS
8
-then
9
- skip_all='skipping upload-pack ref-in-want tests; Perl not available'
10
- test_done
11
-fi
12
-
7
get_actual_refs () {
8
sed -n -e '/wanted-refs/,/0001/{
9
/wanted-refs/d
@@ -89,18 +83,15 @@ test_expect_success 'setup repository' '
83
84
test_expect_success 'config controls ref-in-want advertisement' '
85
test-tool serve-v2 --advertise-capabilities >out &&
92
- perl -ne "/ref-in-want/ and print" out >out.filter &&
93
- test_must_be_empty out.filter &&
86
+ test_grep ! "ref-in-want" out &&
87
88
git config uploadpack.allowRefInWant false &&
89
test-tool serve-v2 --advertise-capabilities >out &&
97
- perl -ne "/ref-in-want/ and print" out >out.filter &&
98
- test_must_be_empty out.filter &&
90
+ test_grep ! "ref-in-want" out &&
91
92
git config uploadpack.allowRefInWant true &&
93
test-tool serve-v2 --advertise-capabilities >out &&
102
- perl -ne "/ref-in-want/ and print" out >out.filter &&
103
- test_file_not_empty out.filter
94
+ test_grep "ref-in-want" out
95
'
96
97
test_expect_success 'invalid want-ref line' '
@@ -486,7 +477,7 @@ inconsistency () {
477
EOF
478
}
479
489
-test_expect_success 'server is initially ahead - no ref in want' '
480
+test_expect_success PERL_TEST_HELPERS 'server is initially ahead - no ref in want' '
481
git -C "$REPO" config uploadpack.allowRefInWant false &&
482
rm -rf local &&
483
cp -r "$LOCAL_PRISTINE" local &&
@@ -495,7 +486,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
486
test_grep "fatal: remote error: upload-pack: not our ref" err
487
'
488
498
-test_expect_success 'server is initially ahead - ref in want' '
489
+test_expect_success PERL_TEST_HELPERS 'server is initially ahead - ref in want' '
490
git -C "$REPO" config uploadpack.allowRefInWant true &&
491
rm -rf local &&
492
cp -r "$LOCAL_PRISTINE" local &&
@@ -507,7 +498,7 @@ test_expect_success 'server is initially ahead - ref in want' '
498
test_cmp expected actual
499
'
500
510
-test_expect_success 'server is initially behind - no ref in want' '
501
+test_expect_success PERL_TEST_HELPERS 'server is initially behind - no ref in want' '
502
git -C "$REPO" config uploadpack.allowRefInWant false &&
503
rm -rf local &&
504
cp -r "$LOCAL_PRISTINE" local &&
@@ -519,7 +510,7 @@ test_expect_success 'server is initially behind - no ref in want' '
510
test_cmp expected actual
511
'
512
522
-test_expect_success 'server is initially behind - ref in want' '
513
+test_expect_success PERL_TEST_HELPERS 'server is initially behind - ref in want' '
514
git -C "$REPO" config uploadpack.allowRefInWant true &&
515
rm -rf local &&
516
cp -r "$LOCAL_PRISTINE" local &&
@@ -531,7 +522,7 @@ test_expect_success 'server is initially behind - ref in want' '
522
test_cmp expected actual
523
'
524
534
-test_expect_success 'server loses a ref - ref in want' '
525
+test_expect_success PERL_TEST_HELPERS 'server loses a ref - ref in want' '
526
git -C "$REPO" config uploadpack.allowRefInWant true &&
527
rm -rf local &&
528
cp -r "$LOCAL_PRISTINE" local &&