diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Gate the stats page and add a language breakdown
`max-stats` only bounds the selectable periods now 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.
Diffstat (limited to 'source/cgit.c')
| -rw-r--r-- | source/cgit.c | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 6 insertions, 0 deletions
diff --git a/source/cgit.c b/source/cgit.c index bdfed0b..f83d15d 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -84,6 +84,8 @@ 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; @@ -183,6 +185,8 @@ static void config_cb(const char *name, const char *value) ctx.cfg.enable_follow_links = atoi(value); else if (!strcmp(name, "enable-help")) ctx.cfg.enable_help = 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")) @@ -867,6 +871,8 @@ 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)); |
