t5316: check behavior of pack-objects --depth=0

We'd expect this to cleanly produce no deltas at all (as opposed to getting confused by an out-of-bounds value), and it does. Note we have to adjust our max_chain test helper, which expected to find at least one delta. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 1, 2021 at 10:04 UTC 49ac1d33bbd9d4be4ad8cb9730a07c086f688a5b
1 file changed +8
t/t5316-pack-delta-depth.sh
+8
@@ -69,6 +69,7 @@ test_expect_success 'create series of packs' '
69 max_chain() {
70 git index-pack --verify-stat-only "$1" >output &&
71 perl -lne '
72 + BEGIN { $len = 0 }
73 /chain length = (\d+)/ and $len = $1;
74 END { print $len }
75 ' output
@@ -94,4 +95,11 @@ test_expect_success '--depth limits depth' '
95 test_cmp expect actual
96 '
97
98 +test_expect_success '--depth=0 disables deltas' '
99 + pack=$(git pack-objects --all --depth=0 </dev/null pack) &&
100 + echo 0 >expect &&
101 + max_chain pack-$pack.pack >actual &&
102 + test_cmp expect actual
103 +'
104 +
105 test_done