diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce 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')
-rw-r--r--source/cgit.c48
-rw-r--r--source/cgit.h12
-rw-r--r--source/shared.c2
-rw-r--r--source/ui-atom.c2
-rw-r--r--source/ui-blame.c4
-rw-r--r--source/ui-commit.c2
-rw-r--r--source/ui-patch.c2
-rw-r--r--source/ui-shared.c6
-rw-r--r--source/ui-tag.c2
9 files changed, 41 insertions, 39 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"))
diff --git a/source/cgit.h b/source/cgit.h
index fa52010..8d2d686 100644
--- a/source/cgit.h
+++ b/source/cgit.h
@@ -72,7 +72,7 @@ struct cgit_repo {
char *name;
char *path;
char *desc;
- char *extra_head_content;
+ char *head_content;
char *owner;
char *defbranch;
char *module_link;
@@ -206,10 +206,10 @@ struct cgit_config {
struct date_mode date_mode;
int cache_size;
int cache_dynamic_ttl;
- int cache_repo_ttl;
- int cache_root_ttl;
- int cache_scanrc_ttl;
+ int cache_index_ttl;
+ int cache_scan_ttl;
int cache_static_ttl;
+ int cache_summary_ttl;
int cache_about_ttl;
int cache_snapshot_ttl;
int case_sensitive_sort;
@@ -217,6 +217,7 @@ struct cgit_config {
int enable_filter_overrides;
int enable_follow_links;
int enable_gitmodules_links;
+ int enable_header;
int enable_http_clone;
int enable_index_links;
int enable_index_owner;
@@ -224,6 +225,7 @@ struct cgit_config {
int enable_commit_graph;
int enable_log_filecount;
int enable_log_linecount;
+ int enable_plain_email;
int enable_relative_dates;
int enable_remote_branches;
int enable_subject_links;
@@ -244,8 +246,6 @@ struct cgit_config {
int max_repodesc_len;
int max_blob_size;
int max_stats;
- int noplainemail;
- int noheader;
int renamelimit;
int remove_suffix;
int scan_hidden_path;
diff --git a/source/shared.c b/source/shared.c
index 43b8e56..00d5605 100644
--- a/source/shared.c
+++ b/source/shared.c
@@ -211,7 +211,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
repo->name = repo->url;
repo->path = NULL;
repo->desc = cgit_default_repo_desc;
- repo->extra_head_content = NULL;
+ repo->head_content = NULL;
repo->owner = NULL;
repo->section = ctx.cfg.section;
repo->snapshots = ctx.cfg.snapshots;
diff --git a/source/ui-atom.c b/source/ui-atom.c
index 5ea681e..09d3501 100644
--- a/source/ui-atom.c
+++ b/source/ui-atom.c
@@ -154,7 +154,7 @@ static void print_entry(struct commit *commit, const char *host)
else
html("unknown");
html("</name>\n");
- if (info->author_email && !ctx.cfg.noplainemail)
+ if (info->author_email && ctx.cfg.enable_plain_email)
print_email(info->author_email);
html("</author>\n");
html("<published>");
diff --git a/source/ui-blame.c b/source/ui-blame.c
index c25c2b3..ff3795e 100644
--- a/source/ui-blame.c
+++ b/source/ui-blame.c
@@ -118,14 +118,14 @@ static char *suspect_detail(struct blame_origin *suspect)
info = cgit_parse_commit(suspect->commit);
strbuf_addf(&detail, "author %s", info->author);
- if (!ctx.cfg.noplainemail)
+ if (ctx.cfg.enable_plain_email)
strbuf_addf(&detail, " %s", info->author_email);
strbuf_addf(&detail, " %s\n",
show_date(info->author_date, info->author_tz,
cgit_date_mode(DATE_ISO8601)));
strbuf_addf(&detail, "committer %s", info->committer);
- if (!ctx.cfg.noplainemail)
+ if (ctx.cfg.enable_plain_email)
strbuf_addf(&detail, " %s", info->committer_email);
strbuf_addf(&detail, " %s\n\n",
show_date(info->committer_date, info->committer_tz,
diff --git a/source/ui-commit.c b/source/ui-commit.c
index 8a31010..a35fcec 100644
--- a/source/ui-commit.c
+++ b/source/ui-commit.c
@@ -29,7 +29,7 @@ static void print_ident_row(const char *role, const char *name,
htmlf("<tr><th>%s</th><td>", role);
cgit_open_filter(ctx.repo->email_filter, email, "commit");
html_txt(name);
- if (!ctx.cfg.noplainemail) {
+ if (ctx.cfg.enable_plain_email) {
html(" ");
html_txt(email);
}
diff --git a/source/ui-patch.c b/source/ui-patch.c
index e8ec313..ef63d00 100644
--- a/source/ui-patch.c
+++ b/source/ui-patch.c
@@ -97,7 +97,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
ctx.page.filename = cgit_fmt("%s.patch", rev_range);
cgit_print_http_headers();
- if (ctx.cfg.noplainemail) {
+ if (!ctx.cfg.enable_plain_email) {
rev_argv[FORMAT_ARG] =
"--format=format:From %H Mon Sep 17 00:00:00 "
"2001%nFrom: %an%nDate: %aD%n%w(78,0,1)Subject: "
diff --git a/source/ui-shared.c b/source/ui-shared.c
index 74b5be0..eb81aac 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -1566,8 +1566,8 @@ void cgit_print_docstart(void)
cgit_add_clone_urls(print_rel_vcs_link);
if (ctx.cfg.head_include)
html_include(ctx.cfg.head_include);
- if (ctx.repo && ctx.repo->extra_head_content)
- html(ctx.repo->extra_head_content);
+ if (ctx.repo && ctx.repo->head_content)
+ html(ctx.repo->head_content);
html("</head>\n");
html("<body>\n");
if (ctx.cfg.header)
@@ -1726,7 +1726,7 @@ void cgit_print_pageheader(void)
const struct object_id *pinned;
html("<div id='cgit'>\n");
- if (!ctx.env.authenticated || !ctx.cfg.noheader)
+ if (!ctx.env.authenticated || ctx.cfg.enable_header)
print_header();
if (ctx.env.authenticated)
diff --git a/source/ui-tag.c b/source/ui-tag.c
index 45ec156..469f209 100644
--- a/source/ui-tag.c
+++ b/source/ui-tag.c
@@ -91,7 +91,7 @@ static void print_annotated_tag(const char *revname,
info->tagger_email ? info->tagger_email : "",
"tag");
html_txt(info->tagger);
- if (info->tagger_email && !ctx.cfg.noplainemail) {
+ if (info->tagger_email && ctx.cfg.enable_plain_email) {
html(" ");
html_txt(info->tagger_email);
}