|
diff --git a/cgit.c b/cgit.c index 6c7e811..c263872 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -60,6 +60,10 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) |
60 | repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
60 | repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
61 | else if (!strcmp(name, "enable-log-linecount")) |
61 | else if (!strcmp(name, "enable-log-linecount")) |
62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
| |
63 | else if (!strcmp(name, "enable-remote-branches")) |
| |
64 | repo->enable_remote_branches = atoi(value); |
| |
65 | else if (!strcmp(name, "enable-subject-links")) |
| |
66 | repo->enable_subject_links = atoi(value); |
63 | else if (!strcmp(name, "max-stats")) |
67 | else if (!strcmp(name, "max-stats")) |
64 | repo->max_stats = cgit_find_stats_period(value, NULL); |
68 | repo->max_stats = cgit_find_stats_period(value, NULL); |
65 | else if (!strcmp(name, "module-link")) |
69 | else if (!strcmp(name, "module-link")) |
@@ -137,6 +141,10 @@ void config_cb(const char *name, const char *value) |
137 | ctx.cfg.enable_log_filecount = atoi(value); |
141 | ctx.cfg.enable_log_filecount = atoi(value); |
138 | else if (!strcmp(name, "enable-log-linecount")) |
142 | else if (!strcmp(name, "enable-log-linecount")) |
139 | ctx.cfg.enable_log_linecount = atoi(value); |
143 | ctx.cfg.enable_log_linecount = atoi(value); |
| |
144 | else if (!strcmp(name, "enable-remote-branches")) |
| |
145 | ctx.cfg.enable_remote_branches = atoi(value); |
| |
146 | else if (!strcmp(name, "enable-subject-links")) |
| |
147 | ctx.cfg.enable_subject_links = atoi(value); |
140 | else if (!strcmp(name, "enable-tree-linenumbers")) |
148 | else if (!strcmp(name, "enable-tree-linenumbers")) |
141 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
149 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
142 | else if (!strcmp(name, "max-stats")) |
150 | else if (!strcmp(name, "max-stats")) |
@@ -144,7 +152,7 @@ void config_cb(const char *name, const char *value) |
144 | else if (!strcmp(name, "cache-size")) |
152 | else if (!strcmp(name, "cache-size")) |
145 | ctx.cfg.cache_size = atoi(value); |
153 | ctx.cfg.cache_size = atoi(value); |
146 | else if (!strcmp(name, "cache-root")) |
154 | else if (!strcmp(name, "cache-root")) |
147 | ctx.cfg.cache_root = xstrdup(value); |
155 | ctx.cfg.cache_root = xstrdup(expand_macros(value)); |
148 | else if (!strcmp(name, "cache-root-ttl")) |
156 | else if (!strcmp(name, "cache-root-ttl")) |
149 | ctx.cfg.cache_root_ttl = atoi(value); |
157 | ctx.cfg.cache_root_ttl = atoi(value); |
150 | else if (!strcmp(name, "cache-repo-ttl")) |
158 | else if (!strcmp(name, "cache-repo-ttl")) |
@@ -161,19 +169,23 @@ void config_cb(const char *name, const char *value) |
161 | ctx.cfg.commit_filter = new_filter(value, 0); |
169 | ctx.cfg.commit_filter = new_filter(value, 0); |
162 | else if (!strcmp(name, "embedded")) |
170 | else if (!strcmp(name, "embedded")) |
163 | ctx.cfg.embedded = atoi(value); |
171 | ctx.cfg.embedded = atoi(value); |
| |
172 | else if (!strcmp(name, "max-atom-items")) |
| |
173 | ctx.cfg.max_atom_items = atoi(value); |
164 | else if (!strcmp(name, "max-message-length")) |
174 | else if (!strcmp(name, "max-message-length")) |
165 | ctx.cfg.max_msg_len = atoi(value); |
175 | ctx.cfg.max_msg_len = atoi(value); |
166 | else if (!strcmp(name, "max-repodesc-length")) |
176 | else if (!strcmp(name, "max-repodesc-length")) |
167 | ctx.cfg.max_repodesc_len = atoi(value); |
177 | ctx.cfg.max_repodesc_len = atoi(value); |
| |
178 | else if (!strcmp(name, "max-blob-size")) |
| |
179 | ctx.cfg.max_blob_size = atoi(value); |
168 | else if (!strcmp(name, "max-repo-count")) |
180 | else if (!strcmp(name, "max-repo-count")) |
169 | ctx.cfg.max_repo_count = atoi(value); |
181 | ctx.cfg.max_repo_count = atoi(value); |
170 | else if (!strcmp(name, "max-commit-count")) |
182 | else if (!strcmp(name, "max-commit-count")) |
171 | ctx.cfg.max_commit_count = atoi(value); |
183 | ctx.cfg.max_commit_count = atoi(value); |
172 | else if (!strcmp(name, "scan-path")) |
184 | else if (!strcmp(name, "scan-path")) |
173 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
185 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
174 | process_cached_repolist(value); |
186 | process_cached_repolist(expand_macros(value)); |
175 | else |
187 | else |
176 | scan_tree(value, repo_config); |
188 | scan_tree(expand_macros(value), repo_config); |
177 | else if (!strcmp(name, "source-filter")) |
189 | else if (!strcmp(name, "source-filter")) |
178 | ctx.cfg.source_filter = new_filter(value, 1); |
190 | ctx.cfg.source_filter = new_filter(value, 1); |
179 | else if (!strcmp(name, "summary-log")) |
191 | else if (!strcmp(name, "summary-log")) |
@@ -182,6 +194,8 @@ void config_cb(const char *name, const char *value) |
182 | ctx.cfg.summary_branches = atoi(value); |
194 | ctx.cfg.summary_branches = atoi(value); |
183 | else if (!strcmp(name, "summary-tags")) |
195 | else if (!strcmp(name, "summary-tags")) |
184 | ctx.cfg.summary_tags = atoi(value); |
196 | ctx.cfg.summary_tags = atoi(value); |
| |
197 | else if (!strcmp(name, "side-by-side-diffs")) |
| |
198 | ctx.cfg.ssdiff = atoi(value); |
185 | else if (!strcmp(name, "agefile")) |
199 | else if (!strcmp(name, "agefile")) |
186 | ctx.cfg.agefile = xstrdup(value); |
200 | ctx.cfg.agefile = xstrdup(value); |
187 | else if (!strcmp(name, "renamelimit")) |
201 | else if (!strcmp(name, "renamelimit")) |
@@ -195,7 +209,7 @@ void config_cb(const char *name, const char *value) |
195 | else if (!prefixcmp(name, "mimetype.")) |
209 | else if (!prefixcmp(name, "mimetype.")) |
196 | add_mimetype(name + 9, value); |
210 | add_mimetype(name + 9, value); |
197 | else if (!strcmp(name, "include")) |
211 | else if (!strcmp(name, "include")) |
198 | parse_configfile(value, config_cb); |
212 | parse_configfile(expand_macros(value), config_cb); |
199 | } |
213 | } |
200 | |
214 | |
201 | static void querystring_cb(const char *name, const char *value) |
215 | static void querystring_cb(const char *name, const char *value) |
@@ -209,6 +223,8 @@ static void querystring_cb(const char *name, const char *value) |
209 | } else if (!strcmp(name, "p")) { |
223 | } else if (!strcmp(name, "p")) { |
210 | ctx.qry.page = xstrdup(value); |
224 | ctx.qry.page = xstrdup(value); |
211 | } else if (!strcmp(name, "url")) { |
225 | } else if (!strcmp(name, "url")) { |
| |
226 | if (*value == '/') |
| |
227 | value++; |
212 | ctx.qry.url = xstrdup(value); |
228 | ctx.qry.url = xstrdup(value); |
213 | cgit_parse_url(value); |
229 | cgit_parse_url(value); |
214 | } else if (!strcmp(name, "qt")) { |
230 | } else if (!strcmp(name, "qt")) { |
@@ -238,6 +254,14 @@ static void querystring_cb(const char *name, const char *value) |
238 | ctx.qry.showmsg = atoi(value); |
254 | ctx.qry.showmsg = atoi(value); |
239 | } else if (!strcmp(name, "period")) { |
255 | } else if (!strcmp(name, "period")) { |
240 | ctx.qry.period = xstrdup(value); |
256 | ctx.qry.period = xstrdup(value); |
| |
257 | } else if (!strcmp(name, "ss")) { |
| |
258 | ctx.qry.ssdiff = atoi(value); |
| |
259 | } else if (!strcmp(name, "all")) { |
| |
260 | ctx.qry.show_all = atoi(value); |
| |
261 | } else if (!strcmp(name, "context")) { |
| |
262 | ctx.qry.context = atoi(value); |
| |
263 | } else if (!strcmp(name, "ignorews")) { |
| |
264 | ctx.qry.ignorews = atoi(value); |
241 | } |
265 | } |
242 | } |
266 | } |
243 | |
267 | |
@@ -268,6 +292,7 @@ static void prepare_context(struct cgit_context *ctx) |
268 | ctx->cfg.max_lock_attempts = 5; |
292 | ctx->cfg.max_lock_attempts = 5; |
269 | ctx->cfg.max_msg_len = 80; |
293 | ctx->cfg.max_msg_len = 80; |
270 | ctx->cfg.max_repodesc_len = 80; |
294 | ctx->cfg.max_repodesc_len = 80; |
| |
295 | ctx->cfg.max_blob_size = 0; |
271 | ctx->cfg.max_stats = 0; |
296 | ctx->cfg.max_stats = 0; |
272 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
297 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
273 | ctx->cfg.renamelimit = -1; |
298 | ctx->cfg.renamelimit = -1; |
@@ -279,6 +304,8 @@ static void prepare_context(struct cgit_context *ctx) |
279 | ctx->cfg.summary_branches = 10; |
304 | ctx->cfg.summary_branches = 10; |
280 | ctx->cfg.summary_log = 10; |
305 | ctx->cfg.summary_log = 10; |
281 | ctx->cfg.summary_tags = 10; |
306 | ctx->cfg.summary_tags = 10; |
| |
307 | ctx->cfg.max_atom_items = 10; |
| |
308 | ctx->cfg.ssdiff = 0; |
282 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
309 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
283 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
310 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
284 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
311 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
@@ -410,6 +437,12 @@ static void process_request(void *cbdata) |
410 | return; |
437 | return; |
411 | } |
438 | } |
412 | |
439 | |
| |
440 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" |
| |
441 | * in-project path limit to be made available at ctx->qry.vpath. |
| |
442 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). |
| |
443 | */ |
| |
444 | ctx->qry.vpath = cmd->want_vpath ? ctx->qry.path : NULL; |
| |
445 | |
413 | if (cmd->want_repo && !ctx->repo) { |
446 | if (cmd->want_repo && !ctx->repo) { |
414 | cgit_print_http_headers(ctx); |
447 | cgit_print_http_headers(ctx); |
415 | cgit_print_docstart(ctx); |
448 | cgit_print_docstart(ctx); |
@@ -674,7 +707,7 @@ int main(int argc, const char **argv) |
674 | cgit_repolist.repos = NULL; |
707 | cgit_repolist.repos = NULL; |
675 | |
708 | |
676 | cgit_parse_args(argc, argv); |
709 | cgit_parse_args(argc, argv); |
677 | parse_configfile(ctx.env.cgit_config, config_cb); |
710 | parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); |
678 | ctx.repo = NULL; |
711 | ctx.repo = NULL; |
679 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
712 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
680 | |
713 | |
|