t5613: clarify "too deep" recursion tests

These tests are just trying to show that we allow recursion up to a certain depth, but not past it. But the counting is a bit non-intuitive, and rather than test at the edge of the breakage, we test "OK" cases in the middle of the chain. Let's explain what's going on, and explicitly test the switch between "OK" and "too deep". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 3, 2016 at 16:34 UTC f0f86fa9f3e2c0199d492ce7779761f1b5470b65
1 file changed +19 -8
t/t5613-info-alternate.sh
+19 -8
@@ -39,6 +39,21 @@ test_expect_success 'preparing third repository' '
39 )
40 '
41
42 +# Note: These tests depend on the hard-coded value of 5 as the maximum depth
43 +# we will follow recursion. We start the depth at 0 and count links, not
44 +# repositories. This means that in a chain like:
45 +#
46 +# A --> B --> C --> D --> E --> F --> G --> H
47 +# 0 1 2 3 4 5 6
48 +#
49 +# we are OK at "G", but break at "H", even though "H" is actually the 8th
50 +# repository, not the 6th, which you might expect. Counting the links allows
51 +# N+1 repositories, and counting from 0 to 5 inclusive allows 6 links.
52 +#
53 +# Note also that we must use "--bare -l" to make the link to H. The "-l"
54 +# ensures we do not do a connectivity check, and the "--bare" makes sure
55 +# we do not try to checkout the result (which needs objects), either of
56 +# which would cause the clone to fail.
57 test_expect_success 'creating too deep nesting' '
58 git clone -l -s C D &&
59 git clone -l -s D E &&
@@ -47,16 +62,12 @@ test_expect_success 'creating too deep nesting' '
62 git clone --bare -l -s G H
63 '
64
50 -test_expect_success 'invalidity of deepest repository' '
51 - test_must_fail git -C H fsck
52 -'
53 -
54 -test_expect_success 'validity of third repository' '
55 - git -C C fsck
65 +test_expect_success 'validity of seventh repository' '
66 + git -C G fsck
67 '
68
58 -test_expect_success 'validity of fourth repository' '
59 - git -C D fsck
69 +test_expect_success 'invalidity of eighth repository' '
70 + test_must_fail git -C H fsck
71 '
72
73 test_expect_success 'breaking of loops' '