|
diff --git a/shared.c b/shared.c index 84aa281..f063894 100644 --- a/ shared.c+++ b/ shared.c |
|
@@ -23,12 +23,14 @@ char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; |
23 | char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; |
23 | char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; |
24 | char *cgit_agefile = "info/web/last-modified"; |
24 | char *cgit_agefile = "info/web/last-modified"; |
25 | char *cgit_virtual_root = NULL; |
25 | char *cgit_virtual_root = NULL; |
26 | char *cgit_script_name = CGIT_SCRIPT_NAME; |
26 | char *cgit_script_name = CGIT_SCRIPT_NAME; |
27 | char *cgit_cache_root = CGIT_CACHE_ROOT; |
27 | char *cgit_cache_root = CGIT_CACHE_ROOT; |
28 | char *cgit_repo_group = NULL; |
28 | char *cgit_repo_group = NULL; |
| |
29 | char *cgit_robots = "index, nofollow"; |
| |
30 | char *cgit_clone_prefix = NULL; |
29 | |
31 | |
30 | int cgit_nocache = 0; |
32 | int cgit_nocache = 0; |
31 | int cgit_snapshots = 0; |
33 | int cgit_snapshots = 0; |
32 | int cgit_enable_index_links = 0; |
34 | int cgit_enable_index_links = 0; |
33 | int cgit_enable_log_filecount = 0; |
35 | int cgit_enable_log_filecount = 0; |
34 | int cgit_enable_log_linecount = 0; |
36 | int cgit_enable_log_linecount = 0; |
@@ -65,13 +67,13 @@ int cgit_query_ofs = 0; |
65 | int htmlfd = 0; |
67 | int htmlfd = 0; |
66 | |
68 | |
67 | |
69 | |
68 | int cgit_get_cmd_index(const char *cmd) |
70 | int cgit_get_cmd_index(const char *cmd) |
69 | { |
71 | { |
70 | static char *cmds[] = {"log", "commit", "diff", "tree", "blob", |
72 | static char *cmds[] = {"log", "commit", "diff", "tree", "blob", |
71 | "snapshot", "tag", "refs", NULL}; |
73 | "snapshot", "tag", "refs", "patch", NULL}; |
72 | int i; |
74 | int i; |
73 | |
75 | |
74 | for(i = 0; cmds[i]; i++) |
76 | for(i = 0; cmds[i]; i++) |
75 | if (!strcmp(cmd, cmds[i])) |
77 | if (!strcmp(cmd, cmds[i])) |
76 | return i + 1; |
78 | return i + 1; |
77 | return 0; |
79 | return 0; |
@@ -194,20 +196,26 @@ void cgit_global_config_cb(const char *name, const char *value) |
194 | else if (!strcmp(name, "summary-tags")) |
196 | else if (!strcmp(name, "summary-tags")) |
195 | cgit_summary_tags = atoi(value); |
197 | cgit_summary_tags = atoi(value); |
196 | else if (!strcmp(name, "agefile")) |
198 | else if (!strcmp(name, "agefile")) |
197 | cgit_agefile = xstrdup(value); |
199 | cgit_agefile = xstrdup(value); |
198 | else if (!strcmp(name, "renamelimit")) |
200 | else if (!strcmp(name, "renamelimit")) |
199 | cgit_renamelimit = atoi(value); |
201 | cgit_renamelimit = atoi(value); |
| |
202 | else if (!strcmp(name, "robots")) |
| |
203 | cgit_robots = xstrdup(value); |
| |
204 | else if (!strcmp(name, "clone-prefix")) |
| |
205 | cgit_clone_prefix = xstrdup(value); |
200 | else if (!strcmp(name, "repo.group")) |
206 | else if (!strcmp(name, "repo.group")) |
201 | cgit_repo_group = xstrdup(value); |
207 | cgit_repo_group = xstrdup(value); |
202 | else if (!strcmp(name, "repo.url")) |
208 | else if (!strcmp(name, "repo.url")) |
203 | cgit_repo = add_repo(value); |
209 | cgit_repo = add_repo(value); |
204 | else if (!strcmp(name, "repo.name")) |
210 | else if (!strcmp(name, "repo.name")) |
205 | cgit_repo->name = xstrdup(value); |
211 | cgit_repo->name = xstrdup(value); |
206 | else if (cgit_repo && !strcmp(name, "repo.path")) |
212 | else if (cgit_repo && !strcmp(name, "repo.path")) |
207 | cgit_repo->path = trim_end(value, '/'); |
213 | cgit_repo->path = trim_end(value, '/'); |
| |
214 | else if (cgit_repo && !strcmp(name, "repo.clone-url")) |
| |
215 | cgit_repo->clone_url = xstrdup(value); |
208 | else if (cgit_repo && !strcmp(name, "repo.desc")) |
216 | else if (cgit_repo && !strcmp(name, "repo.desc")) |
209 | cgit_repo->desc = xstrdup(value); |
217 | cgit_repo->desc = xstrdup(value); |
210 | else if (cgit_repo && !strcmp(name, "repo.owner")) |
218 | else if (cgit_repo && !strcmp(name, "repo.owner")) |
211 | cgit_repo->owner = xstrdup(value); |
219 | cgit_repo->owner = xstrdup(value); |
212 | else if (cgit_repo && !strcmp(name, "repo.defbranch")) |
220 | else if (cgit_repo && !strcmp(name, "repo.defbranch")) |
213 | cgit_repo->defbranch = xstrdup(value); |
221 | cgit_repo->defbranch = xstrdup(value); |
@@ -264,12 +272,14 @@ void *cgit_free_commitinfo(struct commitinfo *info) |
264 | { |
272 | { |
265 | free(info->author); |
273 | free(info->author); |
266 | free(info->author_email); |
274 | free(info->author_email); |
267 | free(info->committer); |
275 | free(info->committer); |
268 | free(info->committer_email); |
276 | free(info->committer_email); |
269 | free(info->subject); |
277 | free(info->subject); |
| |
278 | free(info->msg); |
| |
279 | free(info->msg_encoding); |
270 | free(info); |
280 | free(info); |
271 | return NULL; |
281 | return NULL; |
272 | } |
282 | } |
273 | |
283 | |
274 | int hextoint(char c) |
284 | int hextoint(char c) |
275 | { |
285 | { |
@@ -479,13 +489,13 @@ void cgit_diff_tree(const unsigned char *old_sha1, |
479 | int prefixlen; |
489 | int prefixlen; |
480 | |
490 | |
481 | diff_setup(&opt); |
491 | diff_setup(&opt); |
482 | opt.output_format = DIFF_FORMAT_CALLBACK; |
492 | opt.output_format = DIFF_FORMAT_CALLBACK; |
483 | opt.detect_rename = 1; |
493 | opt.detect_rename = 1; |
484 | opt.rename_limit = cgit_renamelimit; |
494 | opt.rename_limit = cgit_renamelimit; |
485 | opt.recursive = 1; |
495 | DIFF_OPT_SET(&opt, RECURSIVE); |
486 | opt.format_callback = cgit_diff_tree_cb; |
496 | opt.format_callback = cgit_diff_tree_cb; |
487 | opt.format_callback_data = fn; |
497 | opt.format_callback_data = fn; |
488 | if (prefix) { |
498 | if (prefix) { |
489 | opt.nr_paths = 1; |
499 | opt.nr_paths = 1; |
490 | opt.paths = &prefix; |
500 | opt.paths = &prefix; |
491 | prefixlen = strlen(prefix); |
501 | prefixlen = strlen(prefix); |
|