diff options
-rw-r--r--MANUAL.txt4
-rwxr-xr-xtests/t0201-filters.sh12
2 files changed, 15 insertions, 1 deletion
diff --git a/MANUAL.txt b/MANUAL.txt
index d9a8188..cda7dee 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -864,7 +864,9 @@ trailer filter::
the formatted value to be included in the page.
-All filters are handed these environment variables.
+The filters that run for a repository's pages are handed these environment
+variables. The auth filter runs before a repository is chosen and the site's
+about page has none, so neither of them sees these.
- CGIT_REPO_URL (from repo.url)
- CGIT_REPO_NAME (from repo.name)
diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh
index c6b23af..07db677 100755
--- a/tests/t0201-filters.sh
+++ b/tests/t0201-filters.sh
@@ -87,6 +87,18 @@ test_expect_success 'the site readme leaves the tree url empty' '
grep "root.txt SITE" tmp
'
+test_expect_success 'only a repository page hands filters its variables' '
+ write_script env.sh <<-\EOF &&
+ cat >/dev/null
+ echo "repo url: $CGIT_REPO_URL."
+ EOF
+ sed "s|^about-filter=.*|about-filter=exec:$PWD/env.sh|" aboutargsrc >envrc &&
+ CGIT_CONFIG="$PWD/envrc" QUERY_STRING="url=filtered/about/" cgit >tmp &&
+ grep "repo url: filtered\." tmp &&
+ CGIT_CONFIG="$PWD/envrc" QUERY_STRING="p=about" cgit >tmp &&
+ grep "repo url: \." tmp
+'
+
test "$CGIT_HAS_LUA" -eq 1 && test_set_prereq CGIT_LUA
test "$CGIT_HAS_LUA" -eq 1 || say 'cgit built without lua, error page check skipped'