t6120: test describe and name-rev with deep repos
authorMichael J Gruber <git@grubix.eu>
Thu, 7 Sep 2017 14:02:23 +0000 (16:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Sep 2017 01:37:24 +0000 (10:37 +0900)
Depending on the implementation of walks, limitted stack size may lead
to problems (for recursion).

Test name-rev and describe with deep repos and limitted stack size and
mark the former with known failure.

We add these tests (which add gazillions of commits) last so as to keep
the runtime of other subtests the same.

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6120-describe.sh
index 1997ccde56356688cbc66bb77f9a17bd25fd6eae..dd6dd9df9b52647381fb4bb6ff2a1cdc1ade7469 100755 (executable)
@@ -279,4 +279,35 @@ test_expect_success 'describe ignoring a borken submodule' '
        grep broken out
 '
 
+# we require ulimit, this excludes Windows
+test_expect_failure ULIMIT_STACK_SIZE 'name-rev works in a deep repo' '
+       i=1 &&
+       while test $i -lt 8000
+       do
+               echo "commit refs/heads/master
+committer A U Thor <author@example.com> $((1000000000 + $i * 100)) +0200
+data <<EOF
+commit #$i
+EOF"
+               test $i = 1 && echo "from refs/heads/master^0"
+               i=$(($i + 1))
+       done | git fast-import &&
+       git checkout master &&
+       git tag far-far-away HEAD^ &&
+       echo "HEAD~4000 tags/far-far-away~3999" >expect &&
+       git name-rev HEAD~4000 >actual &&
+       test_cmp expect actual &&
+       run_with_limited_stack git name-rev HEAD~4000 >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success ULIMIT_STACK_SIZE 'describe works in a deep repo' '
+       git tag -f far-far-away HEAD~7999 &&
+       echo "far-far-away" >expect &&
+       git describe --tags --abbrev=0 HEAD~4000 >actual &&
+       test_cmp expect actual &&
+       run_with_limited_stack git describe --tags --abbrev=0 HEAD~4000 >actual &&
+       test_cmp expect actual
+'
+
 test_done