From edb59dafb0c11345d563db1e78e4cdb6c1d80d3d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 19 Aug 2026 00:46:22 -0700 Subject: Keep error pages out of the cache --- tests/t0020-validate-cache.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/t0020-validate-cache.sh b/tests/t0020-validate-cache.sh index 0cf7433..feb6275 100755 --- a/tests/t0020-validate-cache.sh +++ b/tests/t0020-validate-cache.sh @@ -154,4 +154,18 @@ test_expect_success 'an ordinary key still fills a slot' ' test_line_count = 1 key.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 +# leave nothing behind, or the real page could never appear once it does. +test_expect_success 'an error page leaves no slot behind' ' + rm -rf cache3 && mkdir cache3 && + CGIT_CONFIG="$PWD/bigkeyrc" \ + QUERY_STRING="url=bigpage/commit/&id=0123456789abcdef0123456789abcdef01234567" \ + cgit >error.out && + grep "Bad commit reference" error.out && + ls cache3 >error.slots && + test_line_count = 0 error.slots +' + test_done -- cgit 2.12.1