diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Rename the inconsistent config keys
noplainemail enable-plain-email
noheader enable-header
cache-root-ttl cache-index-ttl
cache-repo-ttl cache-summary-ttl
cache-scanrc-ttl cache-scan-ttl
agefile age-file
renamelimit rename-limit
extra-head-content head-content
Diffstat (limited to 'source/cgit.c')
| -rw-r--r-- | source/cgit.c | 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 25 insertions, 23 deletions
diff --git a/source/cgit.c b/source/cgit.c index 0e0ea7c..23521f5 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -96,9 +96,9 @@ static void prepare_context(void) ctx.cfg.cache_root = CGIT_CACHE_ROOT; ctx.cfg.cache_about_ttl = 15; ctx.cfg.cache_snapshot_ttl = 5; - ctx.cfg.cache_repo_ttl = 5; - ctx.cfg.cache_root_ttl = 5; - ctx.cfg.cache_scanrc_ttl = 15; + ctx.cfg.cache_summary_ttl = 5; + ctx.cfg.cache_index_ttl = 5; + ctx.cfg.cache_scan_ttl = 15; ctx.cfg.cache_dynamic_ttl = 5; ctx.cfg.cache_static_ttl = -1; ctx.cfg.case_sensitive_sort = 1; @@ -108,6 +108,8 @@ static void prepare_context(void) ctx.cfg.favicon = "/favicon.ico"; ctx.cfg.local_time = 0; ctx.cfg.date_mode = date_mode_from_type(DATE_SHORT); + ctx.cfg.enable_header = 1; + ctx.cfg.enable_plain_email = 1; ctx.cfg.enable_relative_dates = 1; ctx.cfg.enable_http_clone = 1; ctx.cfg.enable_index_owner = 1; @@ -226,8 +228,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo) } if (repo->defbranch) fprintf(f, "repo.defbranch=%s\n", repo->defbranch); - if (repo->extra_head_content) - fprintf(f, "repo.extra-head-content=%s\n", repo->extra_head_content); + if (repo->head_content) + fprintf(f, "repo.head-content=%s\n", repo->head_content); if (repo->module_link) fprintf(f, "repo.module-link=%s\n", repo->module_link); if (repo->section) @@ -459,7 +461,7 @@ static void process_cached_repolist(const char *path) config_file_parse(cached_rc.buf, apply_config); age = time(NULL) - st.st_mtime; - if (age <= (ctx.cfg.cache_scanrc_ttl * 60)) + if (age <= (ctx.cfg.cache_scan_ttl * 60)) goto out; // The list just parsed is stale but usable, so a child rebuilds it @@ -537,10 +539,10 @@ static void apply_config(const char *name, const char *value) ctx.cfg.strict_export = cgit_strdup_first_line(value); else if (!strcmp(name, "virtual-root")) ctx.cfg.virtual_root = cgit_ensure_end(value, '/'); - else if (!strcmp(name, "noplainemail")) - ctx.cfg.noplainemail = atoi(value); - else if (!strcmp(name, "noheader")) - ctx.cfg.noheader = atoi(value); + else if (!strcmp(name, "enable-plain-email")) + ctx.cfg.enable_plain_email = atoi(value); + else if (!strcmp(name, "enable-header")) + ctx.cfg.enable_header = atoi(value); else if (!strcmp(name, "snapshots")) ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); else if (!strcmp(name, "enable-filter-overrides")) @@ -585,12 +587,12 @@ static void apply_config(const char *name, const char *value) ctx.cfg.cache_size = atoi(value); else if (!strcmp(name, "cache-root")) ctx.cfg.cache_root = cgit_strdup_first_line(cgit_expand_macros(value)); - else if (!strcmp(name, "cache-root-ttl")) - ctx.cfg.cache_root_ttl = atoi(value); - else if (!strcmp(name, "cache-repo-ttl")) - ctx.cfg.cache_repo_ttl = atoi(value); - else if (!strcmp(name, "cache-scanrc-ttl")) - ctx.cfg.cache_scanrc_ttl = atoi(value); + else if (!strcmp(name, "cache-index-ttl")) + ctx.cfg.cache_index_ttl = atoi(value); + else if (!strcmp(name, "cache-summary-ttl")) + ctx.cfg.cache_summary_ttl = atoi(value); + else if (!strcmp(name, "cache-scan-ttl")) + ctx.cfg.cache_scan_ttl = atoi(value); else if (!strcmp(name, "cache-static-ttl")) ctx.cfg.cache_static_ttl = atoi(value); else if (!strcmp(name, "cache-dynamic-ttl")) @@ -661,11 +663,11 @@ static void apply_config(const char *name, const char *value) ctx.cfg.summary_tags = atoi(value); else if (!strcmp(name, "side-by-side-diffs")) ctx.cfg.difftype = atoi(value) ? DIFF_SSDIFF : DIFF_UNIFIED; - else if (!strcmp(name, "agefile")) + else if (!strcmp(name, "age-file")) ctx.cfg.agefile = cgit_strdup_first_line(value); else if (!strcmp(name, "mimetype-file")) ctx.cfg.mimetype_file = cgit_strdup_first_line(value); - else if (!strcmp(name, "renamelimit")) + else if (!strcmp(name, "rename-limit")) ctx.cfg.renamelimit = atoi(value); else if (!strcmp(name, "remove-suffix")) ctx.cfg.remove_suffix = atoi(value); @@ -863,10 +865,10 @@ static int is_full_oid(const char *rev) static int calc_ttl(void) { if (!ctx.repo) - return ctx.cfg.cache_root_ttl; + return ctx.cfg.cache_index_ttl; if (!ctx.qry.page) - return ctx.cfg.cache_repo_ttl; + return ctx.cfg.cache_summary_ttl; if (!strcmp(ctx.qry.page, "about")) return ctx.cfg.cache_about_ttl; @@ -885,7 +887,7 @@ static int calc_ttl(void) if (ctx.qry.has_symref) return ctx.cfg.cache_dynamic_ttl; - return ctx.cfg.cache_repo_ttl; + return ctx.cfg.cache_summary_ttl; } /* @@ -1165,8 +1167,8 @@ void cgit_repo_config(struct cgit_repo *repo, const char *name, const char *valu repo->owner = cgit_strdup_first_line(value); else if (!strcmp(name, "defbranch")) repo->defbranch = cgit_strdup_first_line(value); - else if (!strcmp(name, "extra-head-content")) - repo->extra_head_content = cgit_strdup_first_line(value); + else if (!strcmp(name, "head-content")) + repo->head_content = cgit_strdup_first_line(value); else if (!strcmp(name, "snapshots")) repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); else if (!strcmp(name, "enable-blame")) |
