From: Patrick Steinhardt Date: Thu, 3 Apr 2025 05:06:10 +0000 (+0200) Subject: t5316: refactor `max_chain()` to not depend on Perl X-Git-Tag: v2.50.0-rc0~102^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88bef8db847ae45a22e5238e324654d72d078a26;p=thirdparty%2Fgit.git t5316: refactor `max_chain()` to not depend on Perl The `max_chain()` helper function is used to extract the maximum delta chain of a packfile as printed by git-index-pack(1). The script uses Perl to extract that data, but it can be trivially refactored to use awk(1) instead. Refactor the helper accordingly so that we can drop a couple of PERL_TEST_HELPERS prerequisites. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/t/t5316-pack-delta-depth.sh b/t/t5316-pack-delta-depth.sh index cd947b5a5e..defaa06d65 100755 --- a/t/t5316-pack-delta-depth.sh +++ b/t/t5316-pack-delta-depth.sh @@ -76,18 +76,18 @@ test_expect_success 'create series of packs' ' max_chain() { git index-pack --verify-stat-only "$1" >output && - perl -lne ' - BEGIN { $len = 0 } - /chain length = (\d+)/ and $len = $1; - END { print $len } - ' output + awk ' + BEGIN { len=0 } + /chain length = [0-9]+:/{ len=$4 } + END { print len } + ' expect && max_chain pack-$pack.pack >actual && test_cmp expect actual ' -test_expect_success PERL_TEST_HELPERS '--depth=0 disables deltas' ' +test_expect_success '--depth=0 disables deltas' ' pack=$(git pack-objects --all --depth=0 expect && max_chain pack-$pack.pack >actual && test_cmp expect actual ' -test_expect_success PERL_TEST_HELPERS 'negative depth disables deltas' ' +test_expect_success 'negative depth disables deltas' ' pack=$(git pack-objects --all --depth=-1 expect && max_chain pack-$pack.pack >actual &&