|
diff --git a/cgit.c b/cgit.c index 9452884..c263872 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -59,12 +59,14 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) |
59 | else if (!strcmp(name, "enable-log-filecount")) |
59 | else if (!strcmp(name, "enable-log-filecount")) |
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")) |
63 | else if (!strcmp(name, "enable-remote-branches")) |
64 | repo->enable_remote_branches = atoi(value); |
64 | repo->enable_remote_branches = atoi(value); |
| |
65 | else if (!strcmp(name, "enable-subject-links")) |
| |
66 | repo->enable_subject_links = atoi(value); |
65 | else if (!strcmp(name, "max-stats")) |
67 | else if (!strcmp(name, "max-stats")) |
66 | repo->max_stats = cgit_find_stats_period(value, NULL); |
68 | repo->max_stats = cgit_find_stats_period(value, NULL); |
67 | else if (!strcmp(name, "module-link")) |
69 | else if (!strcmp(name, "module-link")) |
68 | repo->module_link= xstrdup(value); |
70 | repo->module_link= xstrdup(value); |
69 | else if (!strcmp(name, "section")) |
71 | else if (!strcmp(name, "section")) |
70 | repo->section = xstrdup(value); |
72 | repo->section = xstrdup(value); |
@@ -138,20 +140,22 @@ void config_cb(const char *name, const char *value) |
138 | else if (!strcmp(name, "enable-log-filecount")) |
140 | else if (!strcmp(name, "enable-log-filecount")) |
139 | ctx.cfg.enable_log_filecount = atoi(value); |
141 | ctx.cfg.enable_log_filecount = atoi(value); |
140 | else if (!strcmp(name, "enable-log-linecount")) |
142 | else if (!strcmp(name, "enable-log-linecount")) |
141 | ctx.cfg.enable_log_linecount = atoi(value); |
143 | ctx.cfg.enable_log_linecount = atoi(value); |
142 | else if (!strcmp(name, "enable-remote-branches")) |
144 | else if (!strcmp(name, "enable-remote-branches")) |
143 | ctx.cfg.enable_remote_branches = atoi(value); |
145 | ctx.cfg.enable_remote_branches = atoi(value); |
| |
146 | else if (!strcmp(name, "enable-subject-links")) |
| |
147 | ctx.cfg.enable_subject_links = atoi(value); |
144 | else if (!strcmp(name, "enable-tree-linenumbers")) |
148 | else if (!strcmp(name, "enable-tree-linenumbers")) |
145 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
149 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
146 | else if (!strcmp(name, "max-stats")) |
150 | else if (!strcmp(name, "max-stats")) |
147 | ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); |
151 | ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); |
148 | else if (!strcmp(name, "cache-size")) |
152 | else if (!strcmp(name, "cache-size")) |
149 | ctx.cfg.cache_size = atoi(value); |
153 | ctx.cfg.cache_size = atoi(value); |
150 | else if (!strcmp(name, "cache-root")) |
154 | else if (!strcmp(name, "cache-root")) |
151 | ctx.cfg.cache_root = xstrdup(value); |
155 | ctx.cfg.cache_root = xstrdup(expand_macros(value)); |
152 | else if (!strcmp(name, "cache-root-ttl")) |
156 | else if (!strcmp(name, "cache-root-ttl")) |
153 | ctx.cfg.cache_root_ttl = atoi(value); |
157 | ctx.cfg.cache_root_ttl = atoi(value); |
154 | else if (!strcmp(name, "cache-repo-ttl")) |
158 | else if (!strcmp(name, "cache-repo-ttl")) |
155 | ctx.cfg.cache_repo_ttl = atoi(value); |
159 | ctx.cfg.cache_repo_ttl = atoi(value); |
156 | else if (!strcmp(name, "cache-scanrc-ttl")) |
160 | else if (!strcmp(name, "cache-scanrc-ttl")) |
157 | ctx.cfg.cache_scanrc_ttl = atoi(value); |
161 | ctx.cfg.cache_scanrc_ttl = atoi(value); |
@@ -162,27 +166,29 @@ void config_cb(const char *name, const char *value) |
162 | else if (!strcmp(name, "about-filter")) |
166 | else if (!strcmp(name, "about-filter")) |
163 | ctx.cfg.about_filter = new_filter(value, 0); |
167 | ctx.cfg.about_filter = new_filter(value, 0); |
164 | else if (!strcmp(name, "commit-filter")) |
168 | else if (!strcmp(name, "commit-filter")) |
165 | ctx.cfg.commit_filter = new_filter(value, 0); |
169 | ctx.cfg.commit_filter = new_filter(value, 0); |
166 | else if (!strcmp(name, "embedded")) |
170 | else if (!strcmp(name, "embedded")) |
167 | 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); |
168 | else if (!strcmp(name, "max-message-length")) |
174 | else if (!strcmp(name, "max-message-length")) |
169 | ctx.cfg.max_msg_len = atoi(value); |
175 | ctx.cfg.max_msg_len = atoi(value); |
170 | else if (!strcmp(name, "max-repodesc-length")) |
176 | else if (!strcmp(name, "max-repodesc-length")) |
171 | ctx.cfg.max_repodesc_len = atoi(value); |
177 | ctx.cfg.max_repodesc_len = atoi(value); |
172 | else if (!strcmp(name, "max-blob-size")) |
178 | else if (!strcmp(name, "max-blob-size")) |
173 | ctx.cfg.max_blob_size = atoi(value); |
179 | ctx.cfg.max_blob_size = atoi(value); |
174 | else if (!strcmp(name, "max-repo-count")) |
180 | else if (!strcmp(name, "max-repo-count")) |
175 | ctx.cfg.max_repo_count = atoi(value); |
181 | ctx.cfg.max_repo_count = atoi(value); |
176 | else if (!strcmp(name, "max-commit-count")) |
182 | else if (!strcmp(name, "max-commit-count")) |
177 | ctx.cfg.max_commit_count = atoi(value); |
183 | ctx.cfg.max_commit_count = atoi(value); |
178 | else if (!strcmp(name, "scan-path")) |
184 | else if (!strcmp(name, "scan-path")) |
179 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
185 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
180 | process_cached_repolist(value); |
186 | process_cached_repolist(expand_macros(value)); |
181 | else |
187 | else |
182 | scan_tree(value, repo_config); |
188 | scan_tree(expand_macros(value), repo_config); |
183 | else if (!strcmp(name, "source-filter")) |
189 | else if (!strcmp(name, "source-filter")) |
184 | ctx.cfg.source_filter = new_filter(value, 1); |
190 | ctx.cfg.source_filter = new_filter(value, 1); |
185 | else if (!strcmp(name, "summary-log")) |
191 | else if (!strcmp(name, "summary-log")) |
186 | ctx.cfg.summary_log = atoi(value); |
192 | ctx.cfg.summary_log = atoi(value); |
187 | else if (!strcmp(name, "summary-branches")) |
193 | else if (!strcmp(name, "summary-branches")) |
188 | ctx.cfg.summary_branches = atoi(value); |
194 | ctx.cfg.summary_branches = atoi(value); |
@@ -200,13 +206,13 @@ void config_cb(const char *name, const char *value) |
200 | ctx.cfg.clone_prefix = xstrdup(value); |
206 | ctx.cfg.clone_prefix = xstrdup(value); |
201 | else if (!strcmp(name, "local-time")) |
207 | else if (!strcmp(name, "local-time")) |
202 | ctx.cfg.local_time = atoi(value); |
208 | ctx.cfg.local_time = atoi(value); |
203 | else if (!prefixcmp(name, "mimetype.")) |
209 | else if (!prefixcmp(name, "mimetype.")) |
204 | add_mimetype(name + 9, value); |
210 | add_mimetype(name + 9, value); |
205 | else if (!strcmp(name, "include")) |
211 | else if (!strcmp(name, "include")) |
206 | parse_configfile(value, config_cb); |
212 | parse_configfile(expand_macros(value), config_cb); |
207 | } |
213 | } |
208 | |
214 | |
209 | static void querystring_cb(const char *name, const char *value) |
215 | static void querystring_cb(const char *name, const char *value) |
210 | { |
216 | { |
211 | if (!value) |
217 | if (!value) |
212 | value = ""; |
218 | value = ""; |
@@ -247,12 +253,14 @@ static void querystring_cb(const char *name, const char *value) |
247 | } else if (!strcmp(name, "showmsg")) { |
253 | } else if (!strcmp(name, "showmsg")) { |
248 | ctx.qry.showmsg = atoi(value); |
254 | ctx.qry.showmsg = atoi(value); |
249 | } else if (!strcmp(name, "period")) { |
255 | } else if (!strcmp(name, "period")) { |
250 | ctx.qry.period = xstrdup(value); |
256 | ctx.qry.period = xstrdup(value); |
251 | } else if (!strcmp(name, "ss")) { |
257 | } else if (!strcmp(name, "ss")) { |
252 | ctx.qry.ssdiff = atoi(value); |
258 | ctx.qry.ssdiff = atoi(value); |
| |
259 | } else if (!strcmp(name, "all")) { |
| |
260 | ctx.qry.show_all = atoi(value); |
253 | } else if (!strcmp(name, "context")) { |
261 | } else if (!strcmp(name, "context")) { |
254 | ctx.qry.context = atoi(value); |
262 | ctx.qry.context = atoi(value); |
255 | } else if (!strcmp(name, "ignorews")) { |
263 | } else if (!strcmp(name, "ignorews")) { |
256 | ctx.qry.ignorews = atoi(value); |
264 | ctx.qry.ignorews = atoi(value); |
257 | } |
265 | } |
258 | } |
266 | } |
@@ -293,12 +301,13 @@ static void prepare_context(struct cgit_context *ctx) |
293 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
301 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
294 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
302 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
295 | ctx->cfg.section = ""; |
303 | ctx->cfg.section = ""; |
296 | ctx->cfg.summary_branches = 10; |
304 | ctx->cfg.summary_branches = 10; |
297 | ctx->cfg.summary_log = 10; |
305 | ctx->cfg.summary_log = 10; |
298 | ctx->cfg.summary_tags = 10; |
306 | ctx->cfg.summary_tags = 10; |
| |
307 | ctx->cfg.max_atom_items = 10; |
299 | ctx->cfg.ssdiff = 0; |
308 | ctx->cfg.ssdiff = 0; |
300 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
309 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
301 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
310 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
302 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
311 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
303 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
312 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
304 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
313 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
@@ -695,13 +704,13 @@ int main(int argc, const char **argv) |
695 | prepare_context(&ctx); |
704 | prepare_context(&ctx); |
696 | cgit_repolist.length = 0; |
705 | cgit_repolist.length = 0; |
697 | cgit_repolist.count = 0; |
706 | cgit_repolist.count = 0; |
698 | cgit_repolist.repos = NULL; |
707 | cgit_repolist.repos = NULL; |
699 | |
708 | |
700 | cgit_parse_args(argc, argv); |
709 | cgit_parse_args(argc, argv); |
701 | parse_configfile(ctx.env.cgit_config, config_cb); |
710 | parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); |
702 | ctx.repo = NULL; |
711 | ctx.repo = NULL; |
703 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
712 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
704 | |
713 | |
705 | /* If virtual-root isn't specified in cgitrc, lets pretend |
714 | /* If virtual-root isn't specified in cgitrc, lets pretend |
706 | * that virtual-root equals SCRIPT_NAME. |
715 | * that virtual-root equals SCRIPT_NAME. |
707 | */ |
716 | */ |
|