Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t6700-tree-depth.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t6700-tree-depth.sh` 111 lines ยท 3237 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='handling of deep trees in various commands' 4 5 . ./test-lib.sh 6 7 # We'll test against two depths here: a small one that will let us check the 8 # behavior of the config setting easily, and a large one that should be 9 # forbidden by default. Testing the default depth will let us know whether our 10 # default is enough to prevent segfaults on systems that run the tests. 11 small_depth=50 12 big_depth=4100 13 14 small_ok="-c core.maxtreedepth=$small_depth" 15 small_no="-c core.maxtreedepth=$((small_depth-1))" 16 17 # usage: mkdeep 18 # Create a tag containing a file whose path has depth . 19 # 20 # We'll use fast-import here for two reasons: 21 # 22 # 1. It's faster than creating $big_depth tree objects. 23 # 24 # 2. As we tighten tree limits, it's more likely to allow large sizes 25 # than trying to stuff a deep path into the index. 26 mkdeep () { 27 { 28 echo "commit refs/tags/$1" && 29 echo "committer foo 1234 -0000" && 30 echo "data </dev/null && 60 test_must_fail git $small_no archive small >/dev/null 61 ' 62 63 test_expect_success 'default limit for git-archive fails gracefully' ' 64 test_must_fail git archive big >/dev/null 65 ' 66 67 test_expect_success 'limit recursion of ls-tree -r' ' 68 git $small_ok ls-tree -r small && 69 test_must_fail git $small_no ls-tree -r small 70 ' 71 72 test_expect_success 'default limit for ls-tree fails gracefully' ' 73 test_must_fail git ls-tree -r big >/dev/null 74 ' 75 76 test_expect_success 'limit recursion of rev-list --objects' ' 77 git $small_ok rev-list --objects small >/dev/null && 78 test_must_fail git $small_no rev-list --objects small >/dev/null 79 ' 80 81 test_expect_success 'default limit for rev-list fails gracefully' ' 82 test_must_fail git rev-list --objects big >/dev/null 83 ' 84 85 # The incremental check needs a boundary; without negative revisions 86 # rev-list falls back to the full check. 87 test_expect_success 'limit recursion of incremental check' ' 88 boundary=$(git commit-tree $EMPTY_TREE -m boundary) && 89 git $small_ok rev-list --connectivity-check=incremental \ 90 --objects small --not $boundary >/dev/null && 91 test_must_fail git $small_no rev-list \ 92 --connectivity-check=incremental --objects small \ 93 --not $boundary >/dev/null 94 ' 95 96 test_expect_success 'default limit for incremental check fails gracefully' ' 97 boundary=$(git commit-tree $EMPTY_TREE -m boundary) && 98 test_must_fail git rev-list --connectivity-check=incremental \ 99 --objects big --not $boundary >/dev/null 100 ' 101 102 test_expect_success 'limit recursion of diff-tree -r' ' 103 git $small_ok diff-tree -r $EMPTY_TREE small && 104 test_must_fail git $small_no diff-tree -r $EMPTY_TREE small 105 ' 106 107 test_expect_success 'default limit for diff-tree fails gracefully' ' 108 test_must_fail git diff-tree -r $EMPTY_TREE big 109 ' 110 111 test_done