diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Gate scanned filters with `trust-scan-filters`
Diffstat (limited to 'tests/t0205-config.sh')
| -rwxr-xr-x | tests/t0205-config.sh | 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 30 insertions, 4 deletions
diff --git a/tests/t0205-config.sh b/tests/t0205-config.sh index a7d32f4..1a4f5d0 100755 --- a/tests/t0205-config.sh +++ b/tests/t0205-config.sh @@ -1,8 +1,9 @@ #!/bin/sh # Checks what the configuration parser reports on stderr. A key it does not -# know, a repo key before any repository and a filter override without its -# enabling flag are each ignored with a warning naming the key, and a config +# know, a repo key before any repository and a filter set by a scanned +# repository without trust-scan-filters are each ignored with a warning naming +# the key, a repo filter in the main cgitrc passes without one, and a config # cgit fully understands stays silent. test_description='Check configuration diagnostics' @@ -40,8 +41,33 @@ test_expect_success 'a repo key before any repo.url is reported' ' grep "Ignoring repo.desc before any repo.url" err ' -test_expect_success 'a filter override without its flag is reported' ' - grep "Ignoring repo about-filter: enable-filter-overrides is not set" err +test_expect_success 'a filter in a scanned repository is reported without its flag' ' + git clone -q --bare repos/foo/.git scan/foo.git && + echo "commit-filter=exec:$FILTER_DIRECTORY/dump.sh" >scan/foo.git/cgitrc && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "scan-path=$PWD/scan" + } >scanrc && + CGIT_CONFIG="$PWD/scanrc" QUERY_STRING="url=foo.git/commit/" cgit >tmp 2>err && + grep "<div class=.commit-subject.>commit 5" tmp && + grep "Ignoring commit-filter in $PWD/scan/foo.git/: trust-scan-filters is not set" err +' + +test_expect_success 'the flag lets a scanned repository set its filters' ' + { + echo "trust-scan-filters=1" && + cat scanrc + } >scanrc-on && + CGIT_CONFIG="$PWD/scanrc-on" QUERY_STRING="url=foo.git/commit/" cgit >tmp 2>err && + grep "<div class=.commit-subject.>COMMIT 5" tmp && + ! grep "Ignoring" err +' + +test_expect_success 'a repo filter in the main cgitrc needs no flag' ' + ! grep "about-filter" err && + CGIT_CONFIG="$PWD/earlyrc" QUERY_STRING="url=diag/" cgit >tmp 2>err && + ! grep "about-filter" err ' test_expect_success 'a fully understood config stays silent' ' |
