From aeea186bfac0dff666793bd941695d52b52c23ce Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:12:55 -1000 Subject: Cache every branch page under cache-dynamic-ttl The dynamic ttl only applied when the url named a branch with h=, so the log, tree and refs of the default branch, which never carry one, fell back to cache-summary-ttl. The manual already gives each ttl the scope the code now uses. --- tests/t0003-cache.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index 3e2a971..bf38fbb 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -212,4 +212,23 @@ test_expect_success 'an expired slot is dropped when its refill is too large' ' test_line_count = 0 refill.slots ' +# The summary page keeps a ttl of its own, while every other page that follows +# a branch rather than a pinned id takes cache-dynamic-ttl, whether or not its +# url names the branch. +test_expect_success 'pages following a branch take the dynamic ttl' ' + rm -rf cache3 && mkdir cache3 && + { + echo "cache-dynamic-ttl=0" && + cat bigkeyrc + } >dynamicrc && + CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/log/" cgit >/dev/null && + CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/log/&h=master" cgit >/dev/null && + ls cache3 >dynamic.slots && + test_line_count = 0 dynamic.slots && + CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/" cgit >/dev/null && + CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/summary/" cgit >/dev/null && + ls cache3 >summary.slots && + test_line_count = 2 summary.slots +' + test_done -- cgit