|
diff --git a/cgit.c b/cgit.c index bfde9f9..08cb5d2 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -144,48 +144,50 @@ void config_cb(const char *name, const char *value) |
144 | else if (!strcmp(name, "cache-size")) |
144 | else if (!strcmp(name, "cache-size")) |
145 | ctx.cfg.cache_size = atoi(value); |
145 | ctx.cfg.cache_size = atoi(value); |
146 | else if (!strcmp(name, "cache-root")) |
146 | else if (!strcmp(name, "cache-root")) |
147 | ctx.cfg.cache_root = xstrdup(value); |
147 | ctx.cfg.cache_root = xstrdup(value); |
148 | else if (!strcmp(name, "cache-root-ttl")) |
148 | else if (!strcmp(name, "cache-root-ttl")) |
149 | ctx.cfg.cache_root_ttl = atoi(value); |
149 | ctx.cfg.cache_root_ttl = atoi(value); |
150 | else if (!strcmp(name, "cache-repo-ttl")) |
150 | else if (!strcmp(name, "cache-repo-ttl")) |
151 | ctx.cfg.cache_repo_ttl = atoi(value); |
151 | ctx.cfg.cache_repo_ttl = atoi(value); |
152 | else if (!strcmp(name, "cache-scanrc-ttl")) |
152 | else if (!strcmp(name, "cache-scanrc-ttl")) |
153 | ctx.cfg.cache_scanrc_ttl = atoi(value); |
153 | ctx.cfg.cache_scanrc_ttl = atoi(value); |
154 | else if (!strcmp(name, "cache-static-ttl")) |
154 | else if (!strcmp(name, "cache-static-ttl")) |
155 | ctx.cfg.cache_static_ttl = atoi(value); |
155 | ctx.cfg.cache_static_ttl = atoi(value); |
156 | else if (!strcmp(name, "cache-dynamic-ttl")) |
156 | else if (!strcmp(name, "cache-dynamic-ttl")) |
157 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
157 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
158 | else if (!strcmp(name, "about-filter")) |
158 | else if (!strcmp(name, "about-filter")) |
159 | ctx.cfg.about_filter = new_filter(value, 0); |
159 | ctx.cfg.about_filter = new_filter(value, 0); |
160 | else if (!strcmp(name, "commit-filter")) |
160 | else if (!strcmp(name, "commit-filter")) |
161 | ctx.cfg.commit_filter = new_filter(value, 0); |
161 | ctx.cfg.commit_filter = new_filter(value, 0); |
162 | else if (!strcmp(name, "embedded")) |
162 | else if (!strcmp(name, "embedded")) |
163 | ctx.cfg.embedded = atoi(value); |
163 | ctx.cfg.embedded = atoi(value); |
164 | else if (!strcmp(name, "max-message-length")) |
164 | else if (!strcmp(name, "max-message-length")) |
165 | ctx.cfg.max_msg_len = atoi(value); |
165 | ctx.cfg.max_msg_len = atoi(value); |
166 | else if (!strcmp(name, "max-repodesc-length")) |
166 | else if (!strcmp(name, "max-repodesc-length")) |
167 | ctx.cfg.max_repodesc_len = atoi(value); |
167 | ctx.cfg.max_repodesc_len = atoi(value); |
| |
168 | else if (!strcmp(name, "max-blob-size")) |
| |
169 | ctx.cfg.max_blob_size = atoi(value); |
168 | else if (!strcmp(name, "max-repo-count")) |
170 | else if (!strcmp(name, "max-repo-count")) |
169 | ctx.cfg.max_repo_count = atoi(value); |
171 | ctx.cfg.max_repo_count = atoi(value); |
170 | else if (!strcmp(name, "max-commit-count")) |
172 | else if (!strcmp(name, "max-commit-count")) |
171 | ctx.cfg.max_commit_count = atoi(value); |
173 | ctx.cfg.max_commit_count = atoi(value); |
172 | else if (!strcmp(name, "scan-path")) |
174 | else if (!strcmp(name, "scan-path")) |
173 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
175 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
174 | process_cached_repolist(value); |
176 | process_cached_repolist(value); |
175 | else |
177 | else |
176 | scan_tree(value, repo_config); |
178 | scan_tree(value, repo_config); |
177 | else if (!strcmp(name, "source-filter")) |
179 | else if (!strcmp(name, "source-filter")) |
178 | ctx.cfg.source_filter = new_filter(value, 1); |
180 | ctx.cfg.source_filter = new_filter(value, 1); |
179 | else if (!strcmp(name, "summary-log")) |
181 | else if (!strcmp(name, "summary-log")) |
180 | ctx.cfg.summary_log = atoi(value); |
182 | ctx.cfg.summary_log = atoi(value); |
181 | else if (!strcmp(name, "summary-branches")) |
183 | else if (!strcmp(name, "summary-branches")) |
182 | ctx.cfg.summary_branches = atoi(value); |
184 | ctx.cfg.summary_branches = atoi(value); |
183 | else if (!strcmp(name, "summary-tags")) |
185 | else if (!strcmp(name, "summary-tags")) |
184 | ctx.cfg.summary_tags = atoi(value); |
186 | ctx.cfg.summary_tags = atoi(value); |
185 | else if (!strcmp(name, "agefile")) |
187 | else if (!strcmp(name, "agefile")) |
186 | ctx.cfg.agefile = xstrdup(value); |
188 | ctx.cfg.agefile = xstrdup(value); |
187 | else if (!strcmp(name, "renamelimit")) |
189 | else if (!strcmp(name, "renamelimit")) |
188 | ctx.cfg.renamelimit = atoi(value); |
190 | ctx.cfg.renamelimit = atoi(value); |
189 | else if (!strcmp(name, "robots")) |
191 | else if (!strcmp(name, "robots")) |
190 | ctx.cfg.robots = xstrdup(value); |
192 | ctx.cfg.robots = xstrdup(value); |
191 | else if (!strcmp(name, "clone-prefix")) |
193 | else if (!strcmp(name, "clone-prefix")) |
@@ -249,48 +251,49 @@ char *xstrdupn(const char *str) |
249 | } |
251 | } |
250 | |
252 | |
251 | static void prepare_context(struct cgit_context *ctx) |
253 | static void prepare_context(struct cgit_context *ctx) |
252 | { |
254 | { |
253 | memset(ctx, 0, sizeof(ctx)); |
255 | memset(ctx, 0, sizeof(ctx)); |
254 | ctx->cfg.agefile = "info/web/last-modified"; |
256 | ctx->cfg.agefile = "info/web/last-modified"; |
255 | ctx->cfg.nocache = 0; |
257 | ctx->cfg.nocache = 0; |
256 | ctx->cfg.cache_size = 0; |
258 | ctx->cfg.cache_size = 0; |
257 | ctx->cfg.cache_dynamic_ttl = 5; |
259 | ctx->cfg.cache_dynamic_ttl = 5; |
258 | ctx->cfg.cache_max_create_time = 5; |
260 | ctx->cfg.cache_max_create_time = 5; |
259 | ctx->cfg.cache_repo_ttl = 5; |
261 | ctx->cfg.cache_repo_ttl = 5; |
260 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
262 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
261 | ctx->cfg.cache_root_ttl = 5; |
263 | ctx->cfg.cache_root_ttl = 5; |
262 | ctx->cfg.cache_scanrc_ttl = 15; |
264 | ctx->cfg.cache_scanrc_ttl = 15; |
263 | ctx->cfg.cache_static_ttl = -1; |
265 | ctx->cfg.cache_static_ttl = -1; |
264 | ctx->cfg.css = "/cgit.css"; |
266 | ctx->cfg.css = "/cgit.css"; |
265 | ctx->cfg.logo = "/cgit.png"; |
267 | ctx->cfg.logo = "/cgit.png"; |
266 | ctx->cfg.local_time = 0; |
268 | ctx->cfg.local_time = 0; |
267 | ctx->cfg.enable_tree_linenumbers = 1; |
269 | ctx->cfg.enable_tree_linenumbers = 1; |
268 | ctx->cfg.max_repo_count = 50; |
270 | ctx->cfg.max_repo_count = 50; |
269 | ctx->cfg.max_commit_count = 50; |
271 | ctx->cfg.max_commit_count = 50; |
270 | ctx->cfg.max_lock_attempts = 5; |
272 | ctx->cfg.max_lock_attempts = 5; |
271 | ctx->cfg.max_msg_len = 80; |
273 | ctx->cfg.max_msg_len = 80; |
272 | ctx->cfg.max_repodesc_len = 80; |
274 | ctx->cfg.max_repodesc_len = 80; |
| |
275 | ctx->cfg.max_blob_size = 0; |
273 | ctx->cfg.max_stats = 0; |
276 | ctx->cfg.max_stats = 0; |
274 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
277 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
275 | ctx->cfg.renamelimit = -1; |
278 | ctx->cfg.renamelimit = -1; |
276 | ctx->cfg.robots = "index, nofollow"; |
279 | ctx->cfg.robots = "index, nofollow"; |
277 | ctx->cfg.root_title = "Git repository browser"; |
280 | ctx->cfg.root_title = "Git repository browser"; |
278 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
281 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
279 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
282 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
280 | ctx->cfg.section = ""; |
283 | ctx->cfg.section = ""; |
281 | ctx->cfg.summary_branches = 10; |
284 | ctx->cfg.summary_branches = 10; |
282 | ctx->cfg.summary_log = 10; |
285 | ctx->cfg.summary_log = 10; |
283 | ctx->cfg.summary_tags = 10; |
286 | ctx->cfg.summary_tags = 10; |
284 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
287 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
285 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
288 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
286 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
289 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
287 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
290 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
288 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
291 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
289 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); |
292 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); |
290 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); |
293 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); |
291 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); |
294 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); |
292 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); |
295 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); |
293 | ctx->env.server_port = xstrdupn(getenv("SERVER_PORT")); |
296 | ctx->env.server_port = xstrdupn(getenv("SERVER_PORT")); |
294 | ctx->page.mimetype = "text/html"; |
297 | ctx->page.mimetype = "text/html"; |
295 | ctx->page.charset = PAGE_ENCODING; |
298 | ctx->page.charset = PAGE_ENCODING; |
296 | ctx->page.filename = NULL; |
299 | ctx->page.filename = NULL; |
|