Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-10-03 23:34:12 +0300
committerJunio C Hamano <gitster@pobox.com>2016-10-10 23:52:36 +0300
commitf0f86fa9f3e2c0199d492ce7779761f1b5470b65 (patch)
tree2e4fc092109deced51540095d77aa5b914156006 /t/t5613-info-alternate.sh
parent8f2ed2675358a6e6543f962f6e1b3ec0737e8079 (diff)
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>
Diffstat (limited to 't/t5613-info-alternate.sh')
-rwxr-xr-xt/t5613-info-alternate.sh27
1 files changed, 19 insertions, 8 deletions
diff --git a/t/t5613-info-alternate.sh b/t/t5613-info-alternate.sh
index 7bc1c3caed..62170b7659 100755
--- a/t/t5613-info-alternate.sh
+++ b/t/t5613-info-alternate.sh
@@ -39,6 +39,21 @@ test_expect_success 'preparing third repository' '
)
'
+# Note: These tests depend on the hard-coded value of 5 as the maximum depth
+# we will follow recursion. We start the depth at 0 and count links, not
+# repositories. This means that in a chain like:
+#
+# A --> B --> C --> D --> E --> F --> G --> H
+# 0 1 2 3 4 5 6
+#
+# we are OK at "G", but break at "H", even though "H" is actually the 8th
+# repository, not the 6th, which you might expect. Counting the links allows
+# N+1 repositories, and counting from 0 to 5 inclusive allows 6 links.
+#
+# Note also that we must use "--bare -l" to make the link to H. The "-l"
+# ensures we do not do a connectivity check, and the "--bare" makes sure
+# we do not try to checkout the result (which needs objects), either of
+# which would cause the clone to fail.
test_expect_success 'creating too deep nesting' '
git clone -l -s C D &&
git clone -l -s D E &&
@@ -47,16 +62,12 @@ test_expect_success 'creating too deep nesting' '
git clone --bare -l -s G H
'
-test_expect_success 'invalidity of deepest repository' '
- test_must_fail git -C H fsck
-'
-
-test_expect_success 'validity of third repository' '
- git -C C fsck
+test_expect_success 'validity of seventh repository' '
+ git -C G fsck
'
-test_expect_success 'validity of fourth repository' '
- git -C D fsck
+test_expect_success 'invalidity of eighth repository' '
+ test_must_fail git -C H fsck
'
test_expect_success 'breaking of loops' '