diff options
Diffstat (limited to 'tests/t0020-validate-cache.sh')
| -rwxr-xr-x | tests/t0020-validate-cache.sh | 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 29 insertions, 0 deletions
diff --git a/tests/t0020-validate-cache.sh b/tests/t0020-validate-cache.sh index feb6275..ca85d97 100755 --- a/tests/t0020-validate-cache.sh +++ b/tests/t0020-validate-cache.sh @@ -154,6 +154,35 @@ test_expect_success 'an ordinary key still fills a slot' ' test_line_count = 1 key.slots ' +# An error page fired after rendering began abandons the fill with part of +# the page already written into the lock file. That fragment must be +# discarded along with the file, not replayed to the visitor behind the +# error page. A commit whose parent object is missing renders its whole +# info table before the diff machinery fails, which makes it the trigger. +test_expect_success 'set up a repo missing a parent object' ' + mkrepo repos/broken 2 && + parent=$(git -C repos/broken rev-parse HEAD^) && + tip=$(git -C repos/broken rev-parse HEAD) && + rm "repos/broken/.git/objects/$(echo "$parent" | cut -c1-2)/$(echo "$parent" | cut -c3-)" && + { + echo "virtual-root=/" && + echo "cache-root=$PWD/cache4" && + echo "cache-size=64" && + echo "repo.url=broken" && + echo "repo.path=$PWD/repos/broken/.git" + } >brokenrc && + rm -rf cache4 && mkdir cache4 +' + +test_expect_success 'an error after output began replays none of it' ' + CGIT_CONFIG="$PWD/brokenrc" QUERY_STRING="url=broken/commit/&id=$tip" \ + cgit >broken.out && + grep "Bad commit" broken.out && + test $(grep -c "^Status:" broken.out) = 1 && + ls cache4 >broken.slots && + test_line_count = 0 broken.slots +' + # An error page reports a condition the repository may grow out of, and a # request pinned to an object id would cache it under the never-expiring # static ttl. Asking for a commit that does not exist yet must therefore |
