From 0f7e60b2e6cadaff2bf2b63d122bbc65ed72d03d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 18:14:14 -1000 Subject: Say which filters get the repository variables --- MANUAL.txt | 4 +++- tests/t0201-filters.sh | 12 ++++++++++++ 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' -- cgit