mirror of
https://git.zx2c4.com/cgit
synced 2025-08-31 22:35:08 +00:00
Add a 'stats' page to each repo
This new page, which is disabled by default, can be used to print some statistics about the number of commits per period in the repository, where period can be either weeks, months, quarters or years. The function can be activated globally by setting 'enable-stats=1' in cgitrc and disabled for individual repos by setting 'repo.enable-stats=0'. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
6
cgit.c
6
cgit.c
@@ -54,6 +54,8 @@ void config_cb(const char *name, const char *value)
|
||||
ctx.cfg.enable_log_filecount = atoi(value);
|
||||
else if (!strcmp(name, "enable-log-linecount"))
|
||||
ctx.cfg.enable_log_linecount = atoi(value);
|
||||
else if (!strcmp(name, "enable-stats"))
|
||||
ctx.cfg.enable_stats = atoi(value);
|
||||
else if (!strcmp(name, "cache-size"))
|
||||
ctx.cfg.cache_size = atoi(value);
|
||||
else if (!strcmp(name, "cache-root"))
|
||||
@@ -112,6 +114,8 @@ void config_cb(const char *name, const char *value)
|
||||
ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value);
|
||||
else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount"))
|
||||
ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
|
||||
else if (ctx.repo && !strcmp(name, "repo.enable-stats"))
|
||||
ctx.repo->enable_stats = ctx.cfg.enable_stats && atoi(value);
|
||||
else if (ctx.repo && !strcmp(name, "repo.module-link"))
|
||||
ctx.repo->module_link= xstrdup(value);
|
||||
else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) {
|
||||
@@ -154,6 +158,8 @@ static void querystring_cb(const char *name, const char *value)
|
||||
ctx.qry.name = xstrdup(value);
|
||||
} else if (!strcmp(name, "mimetype")) {
|
||||
ctx.qry.mimetype = xstrdup(value);
|
||||
} else if (!strcmp(name, "period")) {
|
||||
ctx.qry.period = xstrdup(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user