Skip to content

Commit 31625b3

Browse files
mjggitster
authored andcommitted
t6120: test describe and name-rev with deep repos
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac9b240 commit 31625b3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

t/t6120-describe.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,35 @@ test_expect_success 'describe ignoring a borken submodule' '
279279
grep broken out
280280
'
281281

282+
# we require ulimit, this excludes Windows
283+
test_expect_failure ULIMIT_STACK_SIZE 'name-rev works in a deep repo' '
284+
i=1 &&
285+
while test $i -lt 8000
286+
do
287+
echo "commit refs/heads/master
288+
committer A U Thor <[email protected]> $((1000000000 + $i * 100)) +0200
289+
data <<EOF
290+
commit #$i
291+
EOF"
292+
test $i = 1 && echo "from refs/heads/master^0"
293+
i=$(($i + 1))
294+
done | git fast-import &&
295+
git checkout master &&
296+
git tag far-far-away HEAD^ &&
297+
echo "HEAD~4000 tags/far-far-away~3999" >expect &&
298+
git name-rev HEAD~4000 >actual &&
299+
test_cmp expect actual &&
300+
run_with_limited_stack git name-rev HEAD~4000 >actual &&
301+
test_cmp expect actual
302+
'
303+
304+
test_expect_success ULIMIT_STACK_SIZE 'describe works in a deep repo' '
305+
git tag -f far-far-away HEAD~7999 &&
306+
echo "far-far-away" >expect &&
307+
git describe --tags --abbrev=0 HEAD~4000 >actual &&
308+
test_cmp expect actual &&
309+
run_with_limited_stack git describe --tags --abbrev=0 HEAD~4000 >actual &&
310+
test_cmp expect actual
311+
'
312+
282313
test_done

0 commit comments

Comments
 (0)