From 6fbfebf300fcc92f349db18da05f748c4d355d21 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 6 Sep 2026 14:06:51 -1000 Subject: Fold `enable-stats` back into `max-stats` A `max-stats` period enables the page again, as it did before v2.2.0, so one key does both jobs. --- source/cgit.c | 6 ------ source/cgit.h | 2 -- source/cmd.c | 2 +- source/shared.c | 1 - source/ui-shared.c | 2 +- source/ui-stats.c | 7 +++---- source/ui-tree.c | 2 +- 7 files changed, 6 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/cgit.c b/source/cgit.c index 72e36c8..0e0ea7c 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -255,8 +255,6 @@ static void print_repo(FILE *f, struct cgit_repo *repo) } if (repo->snapshot_prefix) fprintf(f, "repo.snapshot-prefix=%s\n", repo->snapshot_prefix); - if (repo->enable_stats != ctx.cfg.enable_stats) - fprintf(f, "repo.enable-stats=%d\n", repo->enable_stats); if (repo->max_stats != ctx.cfg.max_stats) fprintf(f, "repo.max-stats=%s\n", cgit_find_stats_periodname(repo->max_stats)); @@ -549,8 +547,6 @@ static void apply_config(const char *name, const char *value) ctx.cfg.enable_filter_overrides = atoi(value); else if (!strcmp(name, "enable-follow-links")) ctx.cfg.enable_follow_links = atoi(value); - else if (!strcmp(name, "enable-stats")) - ctx.cfg.enable_stats = atoi(value); else if (!strcmp(name, "enable-http-clone")) ctx.cfg.enable_http_clone = atoi(value); else if (!strcmp(name, "enable-index-links")) @@ -1191,8 +1187,6 @@ void cgit_repo_config(struct cgit_repo *repo, const char *name, const char *valu repo->enable_subject_links = atoi(value); else if (!strcmp(name, "enable-html-serving")) repo->enable_html_serving = atoi(value); - else if (!strcmp(name, "enable-stats")) - repo->enable_stats = atoi(value); else if (!strcmp(name, "branch-sort")) { if (!strcmp(value, "age")) repo->branch_sort = 1; diff --git a/source/cgit.h b/source/cgit.h index bab41c5..fa52010 100644 --- a/source/cgit.h +++ b/source/cgit.h @@ -92,7 +92,6 @@ struct cgit_repo { int enable_remote_branches; int enable_subject_links; int enable_html_serving; - int enable_stats; int max_stats; int branch_sort; int commit_sort; @@ -218,7 +217,6 @@ struct cgit_config { int enable_filter_overrides; int enable_follow_links; int enable_gitmodules_links; - int enable_stats; int enable_http_clone; int enable_index_links; int enable_index_owner; diff --git a/source/cmd.c b/source/cmd.c index 68c395a..b6b1c67 100644 --- a/source/cmd.c +++ b/source/cmd.c @@ -162,7 +162,7 @@ static void snapshot_fn(void) static void stats_fn(void) { - if (ctx.repo->enable_stats) + if (ctx.repo->max_stats) cgit_show_stats(); else cgit_print_error_page(404, "Not Found", "Stats are disabled"); diff --git a/source/shared.c b/source/shared.c index 37c21ae..43b8e56 100644 --- a/source/shared.c +++ b/source/shared.c @@ -224,7 +224,6 @@ struct cgit_repo *cgit_add_repo(const char *url) repo->enable_remote_branches = ctx.cfg.enable_remote_branches; repo->enable_subject_links = ctx.cfg.enable_subject_links; repo->enable_html_serving = ctx.cfg.enable_html_serving; - repo->enable_stats = ctx.cfg.enable_stats; repo->max_stats = ctx.cfg.max_stats; repo->branch_sort = ctx.cfg.branch_sort; repo->commit_sort = ctx.cfg.commit_sort; diff --git a/source/ui-shared.c b/source/ui-shared.c index 5cf9428..74b5be0 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -625,7 +625,7 @@ static void print_repo_tabs(void) tab_class("diff"), ctx.qry.head, ctx.qry.oid, ctx.qry.oid2, ctx.qry.vpath); html("\n"); - if (ctx.repo->enable_stats) { + if (ctx.repo->max_stats) { html("
  • "); cgit_stats_link("stats", "Commit activity", tab_class("stats"), ctx.qry.head, ctx.qry.vpath); diff --git a/source/ui-stats.c b/source/ui-stats.c index 134e4c2..97918e0 100644 --- a/source/ui-stats.c +++ b/source/ui-stats.c @@ -382,9 +382,8 @@ static void print_options_form(const struct cgit_period *period, int top) html("
    "); cgit_add_hidden_formfields(1, 0, "stats"); html("\n"); - if (!ctx.repo->max_stats || ctx.repo->max_stats > 1) { - choices = ctx.repo->max_stats ? - ctx.repo->max_stats : (int)ARRAY_SIZE(periods); + if (ctx.repo->max_stats > 1) { + choices = ctx.repo->max_stats; html(""); html("
    Period: