|
diff --git a/cgit.c b/cgit.c index c82587b..22b6d7c 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -49,16 +49,18 @@ void config_cb(const char *name, const char *value) |
49 | else if (!strcmp(name, "snapshots")) |
49 | else if (!strcmp(name, "snapshots")) |
50 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
50 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
51 | else if (!strcmp(name, "enable-index-links")) |
51 | else if (!strcmp(name, "enable-index-links")) |
52 | ctx.cfg.enable_index_links = atoi(value); |
52 | ctx.cfg.enable_index_links = atoi(value); |
53 | else if (!strcmp(name, "enable-log-filecount")) |
53 | else if (!strcmp(name, "enable-log-filecount")) |
54 | ctx.cfg.enable_log_filecount = atoi(value); |
54 | ctx.cfg.enable_log_filecount = atoi(value); |
55 | else if (!strcmp(name, "enable-log-linecount")) |
55 | else if (!strcmp(name, "enable-log-linecount")) |
56 | ctx.cfg.enable_log_linecount = atoi(value); |
56 | ctx.cfg.enable_log_linecount = atoi(value); |
| |
57 | else if (!strcmp(name, "enable-stats")) |
| |
58 | ctx.cfg.enable_stats = atoi(value); |
57 | else if (!strcmp(name, "cache-size")) |
59 | else if (!strcmp(name, "cache-size")) |
58 | ctx.cfg.cache_size = atoi(value); |
60 | ctx.cfg.cache_size = atoi(value); |
59 | else if (!strcmp(name, "cache-root")) |
61 | else if (!strcmp(name, "cache-root")) |
60 | ctx.cfg.cache_root = xstrdup(value); |
62 | ctx.cfg.cache_root = xstrdup(value); |
61 | else if (!strcmp(name, "cache-root-ttl")) |
63 | else if (!strcmp(name, "cache-root-ttl")) |
62 | ctx.cfg.cache_root_ttl = atoi(value); |
64 | ctx.cfg.cache_root_ttl = atoi(value); |
63 | else if (!strcmp(name, "cache-repo-ttl")) |
65 | else if (!strcmp(name, "cache-repo-ttl")) |
64 | ctx.cfg.cache_repo_ttl = atoi(value); |
66 | ctx.cfg.cache_repo_ttl = atoi(value); |
@@ -107,16 +109,18 @@ void config_cb(const char *name, const char *value) |
107 | else if (ctx.repo && !strcmp(name, "repo.defbranch")) |
109 | else if (ctx.repo && !strcmp(name, "repo.defbranch")) |
108 | ctx.repo->defbranch = xstrdup(value); |
110 | ctx.repo->defbranch = xstrdup(value); |
109 | else if (ctx.repo && !strcmp(name, "repo.snapshots")) |
111 | else if (ctx.repo && !strcmp(name, "repo.snapshots")) |
110 | ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ |
112 | ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ |
111 | else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount")) |
113 | else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount")) |
112 | ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
114 | ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
113 | else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount")) |
115 | else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount")) |
114 | ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
116 | ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
| |
117 | else if (ctx.repo && !strcmp(name, "repo.enable-stats")) |
| |
118 | ctx.repo->enable_stats = ctx.cfg.enable_stats && atoi(value); |
115 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
119 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
116 | ctx.repo->module_link= xstrdup(value); |
120 | ctx.repo->module_link= xstrdup(value); |
117 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
121 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
118 | if (*value == '/') |
122 | if (*value == '/') |
119 | ctx.repo->readme = xstrdup(value); |
123 | ctx.repo->readme = xstrdup(value); |
120 | else |
124 | else |
121 | ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value)); |
125 | ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value)); |
122 | } else if (!strcmp(name, "include")) |
126 | } else if (!strcmp(name, "include")) |
@@ -149,16 +153,18 @@ static void querystring_cb(const char *name, const char *value) |
149 | } else if (!strcmp(name, "ofs")) { |
153 | } else if (!strcmp(name, "ofs")) { |
150 | ctx.qry.ofs = atoi(value); |
154 | ctx.qry.ofs = atoi(value); |
151 | } else if (!strcmp(name, "path")) { |
155 | } else if (!strcmp(name, "path")) { |
152 | ctx.qry.path = trim_end(value, '/'); |
156 | ctx.qry.path = trim_end(value, '/'); |
153 | } else if (!strcmp(name, "name")) { |
157 | } else if (!strcmp(name, "name")) { |
154 | ctx.qry.name = xstrdup(value); |
158 | ctx.qry.name = xstrdup(value); |
155 | } else if (!strcmp(name, "mimetype")) { |
159 | } else if (!strcmp(name, "mimetype")) { |
156 | ctx.qry.mimetype = xstrdup(value); |
160 | ctx.qry.mimetype = xstrdup(value); |
| |
161 | } else if (!strcmp(name, "period")) { |
| |
162 | ctx.qry.period = xstrdup(value); |
157 | } |
163 | } |
158 | } |
164 | } |
159 | |
165 | |
160 | static void prepare_context(struct cgit_context *ctx) |
166 | static void prepare_context(struct cgit_context *ctx) |
161 | { |
167 | { |
162 | memset(ctx, 0, sizeof(ctx)); |
168 | memset(ctx, 0, sizeof(ctx)); |
163 | ctx->cfg.agefile = "info/web/last-modified"; |
169 | ctx->cfg.agefile = "info/web/last-modified"; |
164 | ctx->cfg.nocache = 0; |
170 | ctx->cfg.nocache = 0; |
|