From d7dbbae90da14e3e9428438536f9657d2370a8e5 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 27 Sep 2026 15:06:48 -1000 Subject: Rename enable-trailers to enable-commit-trailers --- MANUAL.txt | 44 ++++++++++++++++++++++---------------------- custom/cgitrc | 23 ++++++++++++----------- source/cgit.c | 10 +++++----- source/cgit.h | 4 ++-- source/shared.c | 2 +- source/ui-commit.c | 2 +- tests/t0206-trailers.sh | 16 ++++++++-------- tests/t0303-robustness.sh | 2 +- tests/t0506-link-trailers.sh | 2 +- 9 files changed, 53 insertions(+), 52 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index e088ea5..10487a3 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -165,6 +165,15 @@ enable-commit-graph:: history graph to the left of the commit messages in the repository log page. Default value: "0". +enable-commit-trailers:: + Flag which, when set to "1", makes the commit page split the trailer + block, the Signed-off-by lines and their kin, off the end of the commit + message and show it as a table under the message. The block is found the + way git finds it for "git interpret-trailers", so the last paragraph is + taken when every line in it is a trailer, or when it holds a + Signed-off-by and at least a quarter of its lines are trailers. Default + value: "0". See also: "trailer-filter", "repo.enable-commit-trailers". + enable-follow-links:: Flag which, when set to "1", allows users to follow a file in the log page. Default value: "0". @@ -257,15 +266,6 @@ enable-subject-links:: commit as link text when generating links to parent commits in the commit page. Default value: "0". See also: "repo.enable-subject-links". -enable-trailers:: - Flag which, when set to "1", makes the commit page split the trailer - block, the Signed-off-by lines and their kin, off the end of the commit - message and show it as a table under the message. The block is found the - way git finds it for "git interpret-trailers", so the last paragraph is - taken when every line in it is a trailer, or when it holds a - Signed-off-by and at least a quarter of its lines are trailers. Default - value: "0". See also: "trailer-filter", "repo.enable-trailers". - enable-tree-group-dirs:: Flag which, when set to "1", makes the tree page list all directories first, sorted, followed by the files. When set to "0", entries appear in @@ -522,15 +522,15 @@ summary-tags:: trailer-filter:: Specifies a command which will be invoked to format the value of a - commit trailer when "enable-trailers" is set. The command will get the - trailer key and an origin page string as its command line arguments and - the value on its stdin, and the stdout from the command will be included - verbatim as the value. Trailers whose value is a name and email address, - such as Signed-off-by, go through the email-filter instead, and when no - trailer-filter is configured the remaining values go through the - commit-filter. A ready filter linking Fixes, Closes and URL values ships - as custom/extensions/link-trailers.lua. Default value: none. See also: - "Filter API". + commit trailer when "enable-commit-trailers" is set. The command will + get the trailer key and an origin page string as its command line + arguments and the value on its stdin, and the stdout from the command + will be included verbatim as the value. Trailers whose value is a name + and email address, such as Signed-off-by, go through the email-filter + instead, and when no trailer-filter is configured the remaining values + go through the commit-filter. A ready filter linking Fixes, Closes and + URL values ships as custom/extensions/link-trailers.lua. Default value: + none. See also: "Filter API". trust-scan-config:: Flag which, when set to "1", honours every setting in a repository's own @@ -599,6 +599,10 @@ repo.enable-commit-graph:: A flag which can be used to override the global setting "enable-commit-graph". Default value: . +repo.enable-commit-trailers:: + A flag which can be used to override the global setting + "enable-commit-trailers". Default value: . + repo.enable-follow-links:: A flag which can be used to override the global setting "enable-follow-links". Default value: . @@ -631,10 +635,6 @@ repo.enable-subject-links:: A flag which can be used to override the global setting "enable-subject-links". Default value: . -repo.enable-trailers:: - A flag which can be used to override the global setting - "enable-trailers". Default value: . - repo.head-content:: This value will be added verbatim to the html HEAD section of each page displayed for this repository. Default value: none. See also: diff --git a/custom/cgitrc b/custom/cgitrc index a594cb2..5935345 100644 --- a/custom/cgitrc +++ b/custom/cgitrc @@ -179,6 +179,11 @@ enable-blame=0 # Default is 0. enable-commit-graph=0 +# Split the trailer block, the Signed-off-by lines and their kin, off the end of +# a commit message and show it as a table on the commit page. Values are 0 or 1. +# Default is 0. +enable-commit-trailers=0 + # Allow following a file across renames in the log page. Values are 0 or 1. # Default is 0. enable-follow-links=0 @@ -220,11 +225,6 @@ enable-remote-branches=0 # 1. Default is 0. enable-subject-links=0 -# Split the trailer block, the Signed-off-by lines and their kin, off the end of -# a commit message and show it as a table on the commit page. Values are 0 or 1. -# Default is 0. -enable-trailers=0 - # Allow /plain to serve HTML mimetypes instead of downgrading to text/plain. # Values are 0 or 1. Default is 0. enable-html-serving=0 @@ -290,8 +290,9 @@ trust-scan-config=0 #email-filter=lua:/usr/local/lib/cgit/filters/email-gravatar.lua # Filter command used to format the value of a commit trailer when -# enable-trailers is 1. The shipped filter links Fixes, Closes and URL values. -# Value is a command optionally prefixed with exec or lua. Default is none. +# enable-commit-trailers is 1. The shipped filter links Fixes, Closes and URL +# values. Value is a command optionally prefixed with exec or lua. 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 @@ -494,6 +495,10 @@ age-file=info/web/last-modified # the global enable-commit-graph value. #repo.enable-commit-graph=0 +# Per-repository override of enable-commit-trailers. Values are 0 or 1. Default +# is the global enable-commit-trailers value. +#repo.enable-commit-trailers=0 + # Per-repository override of enable-follow-links. Values are 0 or 1. Default is # the global enable-follow-links value. #repo.enable-follow-links=0 @@ -522,10 +527,6 @@ age-file=info/web/last-modified # the global enable-subject-links value. #repo.enable-subject-links=0 -# Per-repository override of enable-trailers. Values are 0 or 1. Default is the -# global enable-trailers value. -#repo.enable-trailers=0 - # Per-repository override of enable-html-serving. Values are 0 or 1. Default is # the global enable-html-serving value. #repo.enable-html-serving=0 diff --git a/source/cgit.c b/source/cgit.c index 8601dd0..5806293 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -270,7 +270,7 @@ static void print_repo(FILE *f, struct cgit_repo *repo) fprintf(f, "repo.logo-link=%s\n", repo->logo_link); fprintf(f, "repo.enable-remote-branches=%d\n", repo->enable_remote_branches); fprintf(f, "repo.enable-subject-links=%d\n", repo->enable_subject_links); - fprintf(f, "repo.enable-trailers=%d\n", repo->enable_trailers); + fprintf(f, "repo.enable-commit-trailers=%d\n", repo->enable_commit_trailers); fprintf(f, "repo.enable-html-serving=%d\n", repo->enable_html_serving); if (repo->branch_sort == 1) fprintf(f, "repo.branch-sort=age\n"); @@ -576,8 +576,8 @@ static void apply_config(const char *name, const char *value) ctx.cfg.enable_remote_branches = atoi(value); else if (!strcmp(name, "enable-subject-links")) ctx.cfg.enable_subject_links = atoi(value); - else if (!strcmp(name, "enable-trailers")) - ctx.cfg.enable_trailers = atoi(value); + else if (!strcmp(name, "enable-commit-trailers")) + ctx.cfg.enable_commit_trailers = atoi(value); else if (!strcmp(name, "enable-html-serving")) ctx.cfg.enable_html_serving = atoi(value); else if (!strcmp(name, "enable-tree-linenumbers")) @@ -1251,8 +1251,8 @@ void cgit_repo_config(struct cgit_repo *repo, const char *name, const char *valu repo->enable_remote_branches = atoi(value); else if (!strcmp(name, "enable-subject-links")) repo->enable_subject_links = atoi(value); - else if (!strcmp(name, "enable-trailers")) - repo->enable_trailers = atoi(value); + else if (!strcmp(name, "enable-commit-trailers")) + repo->enable_commit_trailers = atoi(value); else if (!strcmp(name, "enable-html-serving")) repo->enable_html_serving = atoi(value); else if (!strcmp(name, "branch-sort")) { diff --git a/source/cgit.h b/source/cgit.h index 163cd4d..3d3b154 100644 --- a/source/cgit.h +++ b/source/cgit.h @@ -99,7 +99,7 @@ struct cgit_repo { int enable_mailmap; int enable_remote_branches; int enable_subject_links; - int enable_trailers; + int enable_commit_trailers; int enable_html_serving; int max_stats; int branch_sort; @@ -241,7 +241,7 @@ struct cgit_config { int enable_relative_dates; int enable_remote_branches; int enable_subject_links; - int enable_trailers; + int enable_commit_trailers; int enable_html_serving; int enable_tree_linenumbers; int enable_tree_group_dirs; diff --git a/source/shared.c b/source/shared.c index a1d1597..1b610a0 100644 --- a/source/shared.c +++ b/source/shared.c @@ -247,7 +247,7 @@ struct cgit_repo *cgit_add_repo(const char *url) repo->enable_mailmap = ctx.cfg.enable_mailmap; repo->enable_remote_branches = ctx.cfg.enable_remote_branches; repo->enable_subject_links = ctx.cfg.enable_subject_links; - repo->enable_trailers = ctx.cfg.enable_trailers; + repo->enable_commit_trailers = ctx.cfg.enable_commit_trailers; repo->enable_html_serving = ctx.cfg.enable_html_serving; repo->max_stats = ctx.cfg.max_stats; repo->branch_sort = ctx.cfg.branch_sort; diff --git a/source/ui-commit.c b/source/ui-commit.c index 1ac96aa..846dd5d 100644 --- a/source/ui-commit.c +++ b/source/ui-commit.c @@ -208,7 +208,7 @@ static void print_message(struct commitinfo *info) size_t prefix, start, end; char *body = NULL; - if (ctx.repo->enable_trailers) { + if (ctx.repo->enable_commit_trailers) { strbuf_addf(&full, "%s\n\n%s", info->subject, info->msg); prefix = full.len - strlen(info->msg); opts.no_divider = 1; diff --git a/tests/t0206-trailers.sh b/tests/t0206-trailers.sh index 5e10dfc..61fba94 100755 --- a/tests/t0206-trailers.sh +++ b/tests/t0206-trailers.sh @@ -1,11 +1,11 @@ #!/bin/sh # The trailer table on the commit page. A commit whose message ends in a -# trailer block is rendered with enable-trailers on, through the exec dump -# filter as both trailer filter and email filter so the arguments each one -# receives show in the page, then with the flag off globally and off for the -# one repository. The repository carries a mailmap, so the sign-off idents are -# checked to follow it. A commit with no block is checked to get no table. +# trailer block is rendered with enable-commit-trailers on, through the exec +# dump filter as both trailer filter and email filter so the arguments each +# one receives show in the page, then with the flag off globally and off for +# the one repository. The repository carries a mailmap, so the sign-off idents +# are checked to follow it. A commit with no block is checked to get no table. test_description='Check the commit trailers table' CGIT_TEST_NO_CREATE_REPOS=YesPlease @@ -41,7 +41,7 @@ test_expect_success 'point cgit at it with trailers on and the dump filters' ' cat >cgitrc <<-EOF && virtual-root=/ cache-size=0 - enable-trailers=1 + enable-commit-trailers=1 repo.url=trailers repo.path=$PWD/repos/trailers/.git repo.trailer-filter=exec:$FILTER_DIRECTORY/dump.sh @@ -86,14 +86,14 @@ test_expect_success 'a message with no block gets no table' ' ' test_expect_success 'with the flag off the message stays whole' ' - sed "s/^enable-trailers=1/enable-trailers=0/" cgitrc >cgitrc-off && + sed "s/^enable-commit-trailers=1/enable-commit-trailers=0/" cgitrc >cgitrc-off && CGIT_CONFIG="$PWD/cgitrc-off" QUERY_STRING="url=trailers/commit/" cgit >tmp && ! grep "commit-trailers" tmp && grep "Signed-off-by: A U Thor" tmp ' test_expect_success 'the repository flag overrides the global one' ' - echo "repo.enable-trailers=0" >>cgitrc && + echo "repo.enable-commit-trailers=0" >>cgitrc && cgit_url "trailers/commit/" >tmp && ! grep "commit-trailers" tmp && grep "Signed-off-by: A U Thor" tmp diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index f7ca26b..ea50eac 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -227,7 +227,7 @@ test_expect_success 'the commit page shows a message whole when text follows its EOF ) && { - echo "enable-trailers=1" && + echo "enable-commit-trailers=1" && cat robrc } >trailrc && CGIT_CONFIG="$PWD/trailrc" QUERY_STRING="url=rob/commit/" cgit >tmp && diff --git a/tests/t0506-link-trailers.sh b/tests/t0506-link-trailers.sh index 5736c5a..7ce9f53 100755 --- a/tests/t0506-link-trailers.sh +++ b/tests/t0506-link-trailers.sh @@ -46,7 +46,7 @@ test_expect_success 'point cgit at it through the trailer filter' ' cat >cgitrc <<-EOF virtual-root=/ cache-size=0 - enable-trailers=1 + enable-commit-trailers=1 repo.url=linky repo.path=$PWD/repos/linky/.git repo.trailer-filter=lua:$EXTENSIONS_DIRECTORY/link-trailers.lua -- cgit v2.8.0