Skip to content

Commit f0f86fa

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8f2ed26 commit f0f86fa

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

t/t5613-info-alternate.sh

+19-8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ test_expect_success 'preparing third repository' '
3939
)
4040
'
4141

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.
4257
test_expect_success 'creating too deep nesting' '
4358
git clone -l -s C D &&
4459
git clone -l -s D E &&
@@ -47,16 +62,12 @@ test_expect_success 'creating too deep nesting' '
4762
git clone --bare -l -s G H
4863
'
4964

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
5667
'
5768

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
6071
'
6172

6273
test_expect_success 'breaking of loops' '

0 commit comments

Comments
 (0)