Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0003-cache.sh | 47 |
1 file changed, 47 insertions, 0 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index 53a6d5b..02622b5 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -467,6 +467,53 @@ test_expect_success 'a cached scan leaves the description placeholder out' ' ! grep "<meta name=.description." tmp ' +# The list is read back under the global settings, so what a repository set +# against them has to come back with it. This one sorts its branches by name +# where the site sorts by age, turns the site's about filter off and links a +# submodule of its own. A list scanned without the global filter is no good +# to a config that sets one, as it says nothing of the filter turned off. +test_expect_success 'a cached scan keeps what a repository sets' ' + mkrepo kept/one 1 && + sub=$(git -C kept/one rev-parse HEAD) && + ( + cd kept/one && + git update-index --add --cacheinfo 160000,$sub,submod && + git commit -m gitlink && + git branch aaa && + newest=$(echo newest | GIT_COMMITTER_DATE="@2000000000 +0000" git commit-tree HEAD^{tree} -p HEAD) && + git update-ref refs/heads/zzz $newest + ) && + { + echo "branch-sort=name" && + echo "about-filter=" && + echo "readme=:file-1" && + echo "module-link.submod=https://example.org/s/?id=%s" + } >kept/one/.git/cgitrc && + { + echo "virtual-root=/" && + echo "cache-root=$PWD/cache6" && + echo "cache-size=64" && + echo "trust-scan-config=1" && + echo "branch-sort=age" && + echo "scan-path=$PWD/kept" + } >unfilteredrc && + { + echo "about-filter=exec:$FILTER_DIRECTORY/dump.sh" && + cat unfilteredrc + } >keptrc && + rm -rf cache6 && mkdir cache6 && + cgit_rc unfilteredrc "url=" >/dev/null && + cgit_rc keptrc "url=" >/dev/null && + cgit_rc keptrc "url=one/refs/" >tmp && + sed -n "s/^<tr class=.branch.><td><a [^>]*>\([a-z]*\)<.*/\1/p" tmp >branches && + test_write_lines aaa master zzz >expect && + test_cmp expect branches && + cgit_rc keptrc "url=one/about/" >tmp && + grep "<pre class=.plaintext.>1$" tmp && + cgit_rc keptrc "url=one/tree/" >tmp && + grep "href=.https://example.org/s/?id=$sub." tmp +' + # A cache-size below zero turns the page cache off, and the scan with it, so # the cache directory stays empty. test_expect_success 'a negative cache-size leaves the scan uncached' ' |
