| -rw-r--r-- | cgit.c | 17 | ||||
| -rw-r--r-- | cgit.h | 3 | ||||
| -rw-r--r-- | cgitrc.5.txt | 21 | ||||
| -rw-r--r-- | ui-repolist.c | 3 | ||||
| -rw-r--r-- | ui-shared.c | 2 |
5 files changed, 43 insertions, 3 deletions
@@ -111,7 +111,7 @@ static void config_cb(const char *name, const char *value) { const char *arg; - if (!strcmp(name, "section")) + if (!strcmp(name, "section") || !strcmp(name, "repo.group")) ctx.cfg.section = xstrdup(value); else if (!strcmp(name, "repo.url")) ctx.repo = cgit_add_repo(value); @@ -139,14 +139,20 @@ static void config_cb(const char *name, const char *value) ctx.cfg.header = xstrdup(value); else if (!strcmp(name, "logo")) ctx.cfg.logo = xstrdup(value); + else if (!strcmp(name, "index-header")) + ctx.cfg.index_header = xstrdup(value); + else if (!strcmp(name, "index-info")) + ctx.cfg.index_info = xstrdup(value); else if (!strcmp(name, "logo-link")) ctx.cfg.logo_link = xstrdup(value); else if (!strcmp(name, "module-link")) ctx.cfg.module_link = xstrdup(value); else if (!strcmp(name, "strict-export")) ctx.cfg.strict_export = xstrdup(value); - else if (!strcmp(name, "virtual-root")) + else if (!strcmp(name, "virtual-root")) { ctx.cfg.virtual_root = ensure_end(value, '/'); + } else if (!strcmp(name, "nocache")) + ctx.cfg.nocache = atoi(value); else if (!strcmp(name, "noplainemail")) ctx.cfg.noplainemail = atoi(value); else if (!strcmp(name, "noheader")) @@ -230,7 +236,7 @@ static void config_cb(const char *name, const char *value) else if (!strcmp(name, "project-list")) ctx.cfg.project_list = xstrdup(expand_macros(value)); else if (!strcmp(name, "scan-path")) - if (ctx.cfg.cache_size) + if (!ctx.cfg.nocache && ctx.cfg.cache_size) process_cached_repolist(expand_macros(value)); else if (ctx.cfg.project_list) scan_projects(expand_macros(value), @@ -349,6 +355,7 @@ static void prepare_context(void) { memset(&ctx, 0, sizeof(ctx)); ctx.cfg.agefile = "info/web/last-modified"; + ctx.cfg.nocache = 0; ctx.cfg.cache_size = 0; ctx.cfg.cache_max_create_time = 5; ctx.cfg.cache_root = CGIT_CACHE_ROOT; @@ -966,6 +973,8 @@ static void cgit_parse_args(int argc, const char **argv) } if (skip_prefix(argv[i], "--cache=", &arg)) { ctx.cfg.cache_root = xstrdup(arg); + } else if (!strcmp(argv[i], "--nocache")) { + ctx.cfg.nocache = 1; } else if (!strcmp(argv[i], "--nohttp")) { ctx.env.no_http = "1"; } else if (skip_prefix(argv[i], "--query=", &arg)) { @@ -1086,6 +1095,8 @@ int cmd_main(int argc, const char **argv) else ctx.page.expires += ttl * 60; if (!ctx.env.authenticated || (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))) + ctx.cfg.nocache = 1; + if (ctx.cfg.nocache) ctx.cfg.cache_size = 0; err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, ctx.qry.raw, ttl, process_request); @@ -197,6 +197,8 @@ struct cgit_config { char *footer; char *head_include; char *header; + char *index_header; + char *index_info; char *logo; char *logo_link; char *mimetype_file; @@ -246,6 +248,7 @@ struct cgit_config { int max_repodesc_len; int max_blob_size; int max_stats; + int nocache; int noplainemail; int noheader; int renamelimit; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index acfae91..3bfacfa 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -238,6 +238,18 @@ include:: Name of a configfile to include before the rest of the current config- file is parsed. Default value: none. See also: "MACRO EXPANSION". +index-header:: + The content of the file specified with this option will be included + verbatim above the repository index. This setting is deprecated, and + will not be supported by cgit-1.0 (use root-readme instead). Default + value: none. + +index-info:: + The content of the file specified with this option will be included + verbatim below the heading on the repository index page. This setting + is deprecated, and will not be supported by cgit-1.0 (use root-desc + instead). Default value: none. + local-time:: Flag which, if set to "1", makes cgit print commit and tag times in the servers timezone. Default value: "0". @@ -311,6 +323,11 @@ module-link:: formatstring are the path and SHA1 of the submodule commit. Default value: none. +nocache:: + If set to the value "1" caching will be disabled. This settings is + deprecated, and will not be honored starting with cgit-1.0. Default + value: "0". + noplainemail:: If set to "1" showing full author email addresses will be disabled. Default value: "0". @@ -342,6 +359,10 @@ renamelimit:: "-1" uses the compiletime value in git (for further info, look at `man git-diff`). Default value: "-1". +repo.group:: + Legacy alias for "section". This option is deprecated and will not be + supported in cgit-1.0. + repository-sort:: The way in which repositories in each section are sorted. Valid values are "name" for sorting by the repo name or "age" for sorting by the diff --git a/ui-repolist.c b/ui-repolist.c index 41424c0..af52f9b 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -288,6 +288,9 @@ void cgit_print_repolist(void) cgit_print_docstart(); cgit_print_pageheader(); + if (ctx.cfg.index_header) + html_include(ctx.cfg.index_header); + if (ctx.qry.sort) sorted = sort_repolist(ctx.qry.sort); else if (ctx.cfg.section_sort) diff --git a/ui-shared.c b/ui-shared.c index a63dcb0..e8c0723 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -977,6 +977,8 @@ static void print_header(void) } else { if (ctx.cfg.root_desc) html_txt(ctx.cfg.root_desc); + else if (ctx.cfg.index_info) + html_include(ctx.cfg.index_info); } html("</td></tr></table>\n"); } |