From 1c12802497166ddfd51af73b04690841817529c6 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 19 Jul 2026 20:18:37 -1000 Subject: Gate the stats page and add a language breakdown The max-stats setting now only bounds the selectable periods and no longer doubles as the enable switch. The tree walk runs before the history walk on purpose. Releasing commit memory while walking history resets each commit slab index, and a commit graph lookup afterwards would read another commit slot and walk the wrong tree. The stats fixture writes a commit graph so the tests cover that path. The history walk bounds the window in process rather than passing a formatted since date to setup_revisions, and parses each commit once. --- source/cmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/cmd.c') diff --git a/source/cmd.c b/source/cmd.c index a8768eb..84a9d33 100644 --- a/source/cmd.c +++ b/source/cmd.c @@ -162,7 +162,10 @@ static void snapshot_fn(void) static void stats_fn(void) { - cgit_show_stats(); + if (ctx.repo->enable_stats) + cgit_show_stats(); + else + cgit_print_error_page(404, "Not found", "Stats are disabled"); } static void summary_fn(void) -- cgit 2.12.1