diff options
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -60,6 +60,10 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
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")) | ||
64 | repo->enable_remote_branches = atoi(value); | ||
65 | else if (!strcmp(name, "enable-subject-links")) | ||
66 | repo->enable_subject_links = atoi(value); | ||
63 | else if (!strcmp(name, "max-stats")) | 67 | else if (!strcmp(name, "max-stats")) |
64 | repo->max_stats = cgit_find_stats_period(value, NULL); | 68 | repo->max_stats = cgit_find_stats_period(value, NULL); |
65 | else if (!strcmp(name, "module-link")) | 69 | else if (!strcmp(name, "module-link")) |
@@ -137,6 +141,10 @@ void config_cb(const char *name, const char *value) | |||
137 | ctx.cfg.enable_log_filecount = atoi(value); | 141 | ctx.cfg.enable_log_filecount = atoi(value); |
138 | else if (!strcmp(name, "enable-log-linecount")) | 142 | else if (!strcmp(name, "enable-log-linecount")) |
139 | ctx.cfg.enable_log_linecount = atoi(value); | 143 | ctx.cfg.enable_log_linecount = atoi(value); |
144 | else if (!strcmp(name, "enable-remote-branches")) | ||
145 | ctx.cfg.enable_remote_branches = atoi(value); | ||
146 | else if (!strcmp(name, "enable-subject-links")) | ||
147 | ctx.cfg.enable_subject_links = atoi(value); | ||
140 | else if (!strcmp(name, "enable-tree-linenumbers")) | 148 | else if (!strcmp(name, "enable-tree-linenumbers")) |
141 | ctx.cfg.enable_tree_linenumbers = atoi(value); | 149 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
142 | else if (!strcmp(name, "max-stats")) | 150 | else if (!strcmp(name, "max-stats")) |
@@ -161,10 +169,14 @@ void config_cb(const char *name, const char *value) | |||
161 | ctx.cfg.commit_filter = new_filter(value, 0); | 169 | ctx.cfg.commit_filter = new_filter(value, 0); |
162 | else if (!strcmp(name, "embedded")) | 170 | else if (!strcmp(name, "embedded")) |
163 | 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); | ||
164 | else if (!strcmp(name, "max-message-length")) | 174 | else if (!strcmp(name, "max-message-length")) |
165 | ctx.cfg.max_msg_len = atoi(value); | 175 | ctx.cfg.max_msg_len = atoi(value); |
166 | else if (!strcmp(name, "max-repodesc-length")) | 176 | else if (!strcmp(name, "max-repodesc-length")) |
167 | ctx.cfg.max_repodesc_len = atoi(value); | 177 | ctx.cfg.max_repodesc_len = atoi(value); |
178 | else if (!strcmp(name, "max-blob-size")) | ||
179 | ctx.cfg.max_blob_size = atoi(value); | ||
168 | else if (!strcmp(name, "max-repo-count")) | 180 | else if (!strcmp(name, "max-repo-count")) |
169 | ctx.cfg.max_repo_count = atoi(value); | 181 | ctx.cfg.max_repo_count = atoi(value); |
170 | else if (!strcmp(name, "max-commit-count")) | 182 | else if (!strcmp(name, "max-commit-count")) |
@@ -182,6 +194,8 @@ void config_cb(const char *name, const char *value) | |||
182 | ctx.cfg.summary_branches = atoi(value); | 194 | ctx.cfg.summary_branches = atoi(value); |
183 | else if (!strcmp(name, "summary-tags")) | 195 | else if (!strcmp(name, "summary-tags")) |
184 | ctx.cfg.summary_tags = atoi(value); | 196 | ctx.cfg.summary_tags = atoi(value); |
197 | else if (!strcmp(name, "side-by-side-diffs")) | ||
198 | ctx.cfg.ssdiff = atoi(value); | ||
185 | else if (!strcmp(name, "agefile")) | 199 | else if (!strcmp(name, "agefile")) |
186 | ctx.cfg.agefile = xstrdup(value); | 200 | ctx.cfg.agefile = xstrdup(value); |
187 | else if (!strcmp(name, "renamelimit")) | 201 | else if (!strcmp(name, "renamelimit")) |
@@ -209,6 +223,8 @@ static void querystring_cb(const char *name, const char *value) | |||
209 | } else if (!strcmp(name, "p")) { | 223 | } else if (!strcmp(name, "p")) { |
210 | ctx.qry.page = xstrdup(value); | 224 | ctx.qry.page = xstrdup(value); |
211 | } else if (!strcmp(name, "url")) { | 225 | } else if (!strcmp(name, "url")) { |
226 | if (*value == '/') | ||
227 | value++; | ||
212 | ctx.qry.url = xstrdup(value); | 228 | ctx.qry.url = xstrdup(value); |
213 | cgit_parse_url(value); | 229 | cgit_parse_url(value); |
214 | } else if (!strcmp(name, "qt")) { | 230 | } else if (!strcmp(name, "qt")) { |
@@ -238,6 +254,12 @@ static void querystring_cb(const char *name, const char *value) | |||
238 | ctx.qry.showmsg = atoi(value); | 254 | ctx.qry.showmsg = atoi(value); |
239 | } else if (!strcmp(name, "period")) { | 255 | } else if (!strcmp(name, "period")) { |
240 | ctx.qry.period = xstrdup(value); | 256 | ctx.qry.period = xstrdup(value); |
257 | } else if (!strcmp(name, "ss")) { | ||
258 | ctx.qry.ssdiff = atoi(value); | ||
259 | } else if (!strcmp(name, "all")) { | ||
260 | ctx.qry.show_all = atoi(value); | ||
261 | } else if (!strcmp(name, "context")) { | ||
262 | ctx.qry.context = atoi(value); | ||
241 | } | 263 | } |
242 | } | 264 | } |
243 | 265 | ||
@@ -268,6 +290,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
268 | ctx->cfg.max_lock_attempts = 5; | 290 | ctx->cfg.max_lock_attempts = 5; |
269 | ctx->cfg.max_msg_len = 80; | 291 | ctx->cfg.max_msg_len = 80; |
270 | ctx->cfg.max_repodesc_len = 80; | 292 | ctx->cfg.max_repodesc_len = 80; |
293 | ctx->cfg.max_blob_size = 0; | ||
271 | ctx->cfg.max_stats = 0; | 294 | ctx->cfg.max_stats = 0; |
272 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 295 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
273 | ctx->cfg.renamelimit = -1; | 296 | ctx->cfg.renamelimit = -1; |
@@ -279,6 +302,8 @@ static void prepare_context(struct cgit_context *ctx) | |||
279 | ctx->cfg.summary_branches = 10; | 302 | ctx->cfg.summary_branches = 10; |
280 | ctx->cfg.summary_log = 10; | 303 | ctx->cfg.summary_log = 10; |
281 | ctx->cfg.summary_tags = 10; | 304 | ctx->cfg.summary_tags = 10; |
305 | ctx->cfg.max_atom_items = 10; | ||
306 | ctx->cfg.ssdiff = 0; | ||
282 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 307 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
283 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 308 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
284 | ctx->env.https = xstrdupn(getenv("HTTPS")); | 309 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
@@ -410,6 +435,12 @@ static void process_request(void *cbdata) | |||
410 | return; | 435 | return; |
411 | } | 436 | } |
412 | 437 | ||
438 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" | ||
439 | * in-project path limit to be made available at ctx->qry.vpath. | ||
440 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). | ||
441 | */ | ||
442 | ctx->qry.vpath = cmd->want_vpath ? ctx->qry.path : NULL; | ||
443 | |||
413 | if (cmd->want_repo && !ctx->repo) { | 444 | if (cmd->want_repo && !ctx->repo) { |
414 | cgit_print_http_headers(ctx); | 445 | cgit_print_http_headers(ctx); |
415 | cgit_print_docstart(ctx); | 446 | cgit_print_docstart(ctx); |