|
diff --git a/cgit.c b/cgit.c index aa1107a..dbec196 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -24,8 +24,23 @@ void add_mimetype(const char *name, const char *value) |
24 | item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes); |
24 | item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes); |
25 | item->util = xstrdup(value); |
25 | item->util = xstrdup(value); |
26 | } |
26 | } |
27 | |
27 | |
| |
28 | struct cgit_filter *new_filter(const char *cmd, int extra_args) |
| |
29 | { |
| |
30 | struct cgit_filter *f; |
| |
31 | |
| |
32 | if (!cmd || !cmd[0]) |
| |
33 | return NULL; |
| |
34 | |
| |
35 | f = xmalloc(sizeof(struct cgit_filter)); |
| |
36 | f->cmd = xstrdup(cmd); |
| |
37 | f->argv = xmalloc((2 + extra_args) * sizeof(char *)); |
| |
38 | f->argv[0] = f->cmd; |
| |
39 | f->argv[1] = NULL; |
| |
40 | return f; |
| |
41 | } |
| |
42 | |
28 | void config_cb(const char *name, const char *value) |
43 | void config_cb(const char *name, const char *value) |
29 | { |
44 | { |
30 | if (!strcmp(name, "root-title")) |
45 | if (!strcmp(name, "root-title")) |
31 | ctx.cfg.root_title = xstrdup(value); |
46 | ctx.cfg.root_title = xstrdup(value); |
@@ -84,8 +99,10 @@ void config_cb(const char *name, const char *value) |
84 | else if (!strcmp(name, "cache-static-ttl")) |
99 | else if (!strcmp(name, "cache-static-ttl")) |
85 | ctx.cfg.cache_static_ttl = atoi(value); |
100 | ctx.cfg.cache_static_ttl = atoi(value); |
86 | else if (!strcmp(name, "cache-dynamic-ttl")) |
101 | else if (!strcmp(name, "cache-dynamic-ttl")) |
87 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
102 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
| |
103 | else if (!strcmp(name, "commit-filter")) |
| |
104 | ctx.cfg.commit_filter = new_filter(value, 0); |
88 | else if (!strcmp(name, "embedded")) |
105 | else if (!strcmp(name, "embedded")) |
89 | ctx.cfg.embedded = atoi(value); |
106 | ctx.cfg.embedded = atoi(value); |
90 | else if (!strcmp(name, "max-message-length")) |
107 | else if (!strcmp(name, "max-message-length")) |
91 | ctx.cfg.max_msg_len = atoi(value); |
108 | ctx.cfg.max_msg_len = atoi(value); |
@@ -94,8 +111,10 @@ void config_cb(const char *name, const char *value) |
94 | else if (!strcmp(name, "max-repo-count")) |
111 | else if (!strcmp(name, "max-repo-count")) |
95 | ctx.cfg.max_repo_count = atoi(value); |
112 | ctx.cfg.max_repo_count = atoi(value); |
96 | else if (!strcmp(name, "max-commit-count")) |
113 | else if (!strcmp(name, "max-commit-count")) |
97 | ctx.cfg.max_commit_count = atoi(value); |
114 | ctx.cfg.max_commit_count = atoi(value); |
| |
115 | else if (!strcmp(name, "source-filter")) |
| |
116 | ctx.cfg.source_filter = new_filter(value, 1); |
98 | else if (!strcmp(name, "summary-log")) |
117 | else if (!strcmp(name, "summary-log")) |
99 | ctx.cfg.summary_log = atoi(value); |
118 | ctx.cfg.summary_log = atoi(value); |
100 | else if (!strcmp(name, "summary-branches")) |
119 | else if (!strcmp(name, "summary-branches")) |
101 | ctx.cfg.summary_branches = atoi(value); |
120 | ctx.cfg.summary_branches = atoi(value); |
@@ -138,8 +157,12 @@ void config_cb(const char *name, const char *value) |
138 | else if (ctx.repo && !strcmp(name, "repo.max-stats")) |
157 | else if (ctx.repo && !strcmp(name, "repo.max-stats")) |
139 | ctx.repo->max_stats = cgit_find_stats_period(value, NULL); |
158 | ctx.repo->max_stats = cgit_find_stats_period(value, NULL); |
140 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
159 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
141 | ctx.repo->module_link= xstrdup(value); |
160 | ctx.repo->module_link= xstrdup(value); |
| |
161 | else if (ctx.repo && !strcmp(name, "repo.commit-filter")) |
| |
162 | ctx.repo->commit_filter = new_filter(value, 0); |
| |
163 | else if (ctx.repo && !strcmp(name, "repo.source-filter")) |
| |
164 | ctx.repo->source_filter = new_filter(value, 1); |
142 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
165 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
143 | if (*value == '/') |
166 | if (*value == '/') |
144 | ctx.repo->readme = xstrdup(value); |
167 | ctx.repo->readme = xstrdup(value); |
145 | else |
168 | else |
|