From 9d955ba50764760d7a4eb223fd6aa98f9f14ed60 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 18:19:09 -1000 Subject: Add blame to the source filter and line number docs --- MANUAL.txt | 18 +++++++++--------- custom/cgitrc | 12 ++++++------ tests/t0201-filters.sh | 8 ++++++++ 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index 9705bda..ffdd55c 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -285,7 +285,7 @@ enable-tree-group-dirs:: enable-tree-linenumbers:: Flag which, when set to "1", makes cgit generate linenumber links for - plaintext blobs printed in the tree page. Default value: "1". + plaintext blobs printed in the tree and blame pages. Default value: "1". favicon:: Url used as link to the icon for cgit. Any path works, but keeping the @@ -508,14 +508,14 @@ snapshots:: source-filter:: Specifies a command which will be invoked to format plaintext blobs in - the tree page. The command will get the blob content on its stdin and - the name of the blob as its only command line argument. The stdout from - the command will be included verbatim as the blob contents, which is how - syntax highlighting is done. When no source-filter is configured, cgit - serves the text plain. A ready syntax highlighter using the Scintillua - lexer collection ships as custom/extensions/syntax-highlight.lua, see - the comments in that file for its dependencies. Default value: none. See - also: "Filter API". + the tree and blame pages. The command will get the blob content on its + stdin and the name of the blob as its only command line argument. The + stdout from the command will be included verbatim as the blob contents, + which is how syntax highlighting is done. When no source-filter is + configured, cgit serves the text plain. A ready syntax highlighter using + the Scintillua lexer collection ships as + custom/extensions/syntax-highlight.lua, see the comments in that file + for its dependencies. Default value: none. See also: "Filter API". strict-export:: Filename which, if specified, needs to be present within the repository diff --git a/custom/cgitrc b/custom/cgitrc index bc7e88e..1e02f8f 100644 --- a/custom/cgitrc +++ b/custom/cgitrc @@ -236,8 +236,8 @@ enable-subject-links=0 # Values are 0 or 1. Default is 0. enable-html-serving=0 -# Generate line-number links for plaintext blobs in the tree page. Values are 0 -# or 1. Default is 1. +# Generate line-number links for plaintext blobs in the tree and blame pages. +# Values are 0 or 1. Default is 1. enable-tree-linenumbers=1 # List directories first, then files, in the tree page. Values are 0 or 1. @@ -302,10 +302,10 @@ trust-scan-config=0 # Default is none. #trailer-filter=lua:/usr/local/lib/cgit/filters/link-trailers.lua -# Filter command used to format plaintext blobs in the tree page. The shipped -# filter uses the Scintillua lexers and needs lpeg, and missing either means -# plain uncolored text, not an error. Value is a command optionally prefixed -# with exec or lua. Default is none. +# Filter command used to format plaintext blobs in the tree and blame pages. The +# shipped filter uses the Scintillua lexers and needs lpeg, and missing either +# means plain uncolored text, not an error. Value is a command optionally +# prefixed with exec or lua. Default is none. #source-filter=lua:/usr/local/lib/cgit/filters/syntax-highlight.lua # Filter command invoked to authenticate access, gating repositories behind a diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh index 07db677..1dd0910 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -65,6 +65,14 @@ do " done +test_expect_success 'the blame page goes through the source filter too' ' + echo "enable-blame=1" >blamerc && + sed "s/^cache-size=.*/cache-size=0/" cgitrc >>blamerc && + CGIT_CONFIG="$PWD/blamerc" QUERY_STRING="url=filter-exec/blame/a%2bb" cgit >tmp && + grep "" tmp && + grep "a+b HELLO$" tmp +' + # A readme read at another branch links into the tree at that branch, which # the filter is told as the query to follow a path with. test_expect_success 'the about filter gets the tree url at the readme branch' ' -- cgit