|
diff --git a/cgit.c b/cgit.c index 8a30c3c..f0907a1 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -13,3 +13,3 @@ static int cgit_prepare_cache(struct cacheitem *item) |
13 | if (!cgit_repo && ctx.qry.repo) { |
13 | if (!cgit_repo && ctx.qry.repo) { |
14 | char *title = fmt("%s - %s", cgit_root_title, "Bad request"); |
14 | char *title = fmt("%s - %s", ctx.cfg.root_title, "Bad request"); |
15 | cgit_print_docstart(title, item); |
15 | cgit_print_docstart(title, item); |
@@ -22,4 +22,4 @@ static int cgit_prepare_cache(struct cacheitem *item) |
22 | if (!cgit_repo) { |
22 | if (!cgit_repo) { |
23 | item->name = xstrdup(fmt("%s/index.html", cgit_cache_root)); |
23 | item->name = xstrdup(fmt("%s/index.html", ctx.cfg.cache_root)); |
24 | item->ttl = cgit_cache_root_ttl; |
24 | item->ttl = ctx.cfg.cache_root_ttl; |
25 | return 1; |
25 | return 1; |
@@ -28,8 +28,8 @@ static int cgit_prepare_cache(struct cacheitem *item) |
28 | if (!cgit_cmd) { |
28 | if (!cgit_cmd) { |
29 | item->name = xstrdup(fmt("%s/%s/index.%s.html", cgit_cache_root, |
29 | item->name = xstrdup(fmt("%s/%s/index.%s.html", ctx.cfg.cache_root, |
30 | cache_safe_filename(cgit_repo->url), |
30 | cache_safe_filename(cgit_repo->url), |
31 | cache_safe_filename(ctx.qry.raw))); |
31 | cache_safe_filename(ctx.qry.raw))); |
32 | item->ttl = cgit_cache_repo_ttl; |
32 | item->ttl = ctx.cfg.cache_repo_ttl; |
33 | } else { |
33 | } else { |
34 | item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root, |
34 | item->name = xstrdup(fmt("%s/%s/%s/%s.html", ctx.cfg.cache_root, |
35 | cache_safe_filename(cgit_repo->url), |
35 | cache_safe_filename(cgit_repo->url), |
@@ -38,7 +38,7 @@ static int cgit_prepare_cache(struct cacheitem *item) |
38 | if (ctx.qry.has_symref) |
38 | if (ctx.qry.has_symref) |
39 | item->ttl = cgit_cache_dynamic_ttl; |
39 | item->ttl = ctx.cfg.cache_dynamic_ttl; |
40 | else if (ctx.qry.has_sha1) |
40 | else if (ctx.qry.has_sha1) |
41 | item->ttl = cgit_cache_static_ttl; |
41 | item->ttl = ctx.cfg.cache_static_ttl; |
42 | else |
42 | else |
43 | item->ttl = cgit_cache_repo_ttl; |
43 | item->ttl = ctx.cfg.cache_repo_ttl; |
44 | } |
44 | } |
@@ -87,3 +87,3 @@ static void cgit_print_repo_page(struct cacheitem *item) |
87 | if (chdir(cgit_repo->path)) { |
87 | if (chdir(cgit_repo->path)) { |
88 | title = fmt("%s - %s", cgit_root_title, "Bad request"); |
88 | title = fmt("%s - %s", ctx.cfg.root_title, "Bad request"); |
89 | cgit_print_docstart(title, item); |
89 | cgit_print_docstart(title, item); |
@@ -155,3 +155,3 @@ static void cgit_print_repo_page(struct cacheitem *item) |
155 | cgit_print_log(ctx.qry.sha1, ctx.qry.ofs, |
155 | cgit_print_log(ctx.qry.sha1, ctx.qry.ofs, |
156 | cgit_max_commit_count, ctx.qry.grep, ctx.qry.search, |
156 | ctx.cfg.max_commit_count, ctx.qry.grep, ctx.qry.search, |
157 | ctx.qry.path, 1); |
157 | ctx.qry.path, 1); |
@@ -214,3 +214,3 @@ static void cgit_check_cache(struct cacheitem *item) |
214 | top: |
214 | top: |
215 | if (++i > cgit_max_lock_attempts) { |
215 | if (++i > ctx.cfg.max_lock_attempts) { |
216 | die("cgit_refresh_cache: unable to lock %s: %s", |
216 | die("cgit_refresh_cache: unable to lock %s: %s", |
@@ -260,6 +260,6 @@ static void cgit_parse_args(int argc, const char **argv) |
260 | if (!strncmp(argv[i], "--cache=", 8)) { |
260 | if (!strncmp(argv[i], "--cache=", 8)) { |
261 | cgit_cache_root = xstrdup(argv[i]+8); |
261 | ctx.cfg.cache_root = xstrdup(argv[i]+8); |
262 | } |
262 | } |
263 | if (!strcmp(argv[i], "--nocache")) { |
263 | if (!strcmp(argv[i], "--nocache")) { |
264 | cgit_nocache = 1; |
264 | ctx.cfg.nocache = 1; |
265 | } |
265 | } |
@@ -293,2 +293,3 @@ int main(int argc, const char **argv) |
293 | |
293 | |
| |
294 | cgit_prepare_context(&ctx); |
294 | htmlfd = STDOUT_FILENO; |
295 | htmlfd = STDOUT_FILENO; |
@@ -303,3 +304,3 @@ int main(int argc, const char **argv) |
303 | if (getenv("SCRIPT_NAME")) |
304 | if (getenv("SCRIPT_NAME")) |
304 | cgit_script_name = xstrdup(getenv("SCRIPT_NAME")); |
305 | ctx.cfg.script_name = xstrdup(getenv("SCRIPT_NAME")); |
305 | if (getenv("QUERY_STRING")) |
306 | if (getenv("QUERY_STRING")) |
@@ -310,3 +311,3 @@ int main(int argc, const char **argv) |
310 | return 0; |
311 | return 0; |
311 | if (cgit_nocache) { |
312 | if (ctx.cfg.nocache) { |
312 | cgit_fill_cache(&item, 0); |
313 | cgit_fill_cache(&item, 0); |
|