|
diff --git a/cgit.c b/cgit.c index c82587b..6e5215e 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -268,49 +268,48 @@ static int prepare_repo_cmd(struct cgit_context *ctx) |
268 | return 1; |
268 | return 1; |
269 | } |
269 | } |
270 | |
270 | |
271 | if (get_sha1(ctx->qry.head, sha1)) { |
271 | if (get_sha1(ctx->qry.head, sha1)) { |
272 | tmp = xstrdup(ctx->qry.head); |
272 | tmp = xstrdup(ctx->qry.head); |
273 | ctx->qry.head = ctx->repo->defbranch; |
273 | ctx->qry.head = ctx->repo->defbranch; |
274 | cgit_print_http_headers(ctx); |
274 | cgit_print_http_headers(ctx); |
275 | cgit_print_docstart(ctx); |
275 | cgit_print_docstart(ctx); |
276 | cgit_print_pageheader(ctx); |
276 | cgit_print_pageheader(ctx); |
277 | cgit_print_error(fmt("Invalid branch: %s", tmp)); |
277 | cgit_print_error(fmt("Invalid branch: %s", tmp)); |
278 | cgit_print_docend(); |
278 | cgit_print_docend(); |
279 | return 1; |
279 | return 1; |
280 | } |
280 | } |
281 | return 0; |
281 | return 0; |
282 | } |
282 | } |
283 | |
283 | |
284 | static void process_request(void *cbdata) |
284 | static void process_request(void *cbdata) |
285 | { |
285 | { |
286 | struct cgit_context *ctx = cbdata; |
286 | struct cgit_context *ctx = cbdata; |
287 | struct cgit_cmd *cmd; |
287 | struct cgit_cmd *cmd; |
288 | |
288 | |
289 | cmd = cgit_get_cmd(ctx); |
289 | cmd = cgit_get_cmd(ctx); |
290 | if (!cmd) { |
290 | if (!cmd) { |
291 | ctx->page.title = "cgit error"; |
291 | ctx->page.title = "cgit error"; |
292 | ctx->repo = NULL; |
| |
293 | cgit_print_http_headers(ctx); |
292 | cgit_print_http_headers(ctx); |
294 | cgit_print_docstart(ctx); |
293 | cgit_print_docstart(ctx); |
295 | cgit_print_pageheader(ctx); |
294 | cgit_print_pageheader(ctx); |
296 | cgit_print_error("Invalid request"); |
295 | cgit_print_error("Invalid request"); |
297 | cgit_print_docend(); |
296 | cgit_print_docend(); |
298 | return; |
297 | return; |
299 | } |
298 | } |
300 | |
299 | |
301 | if (cmd->want_repo && !ctx->repo) { |
300 | if (cmd->want_repo && !ctx->repo) { |
302 | cgit_print_http_headers(ctx); |
301 | cgit_print_http_headers(ctx); |
303 | cgit_print_docstart(ctx); |
302 | cgit_print_docstart(ctx); |
304 | cgit_print_pageheader(ctx); |
303 | cgit_print_pageheader(ctx); |
305 | cgit_print_error(fmt("No repository selected")); |
304 | cgit_print_error(fmt("No repository selected")); |
306 | cgit_print_docend(); |
305 | cgit_print_docend(); |
307 | return; |
306 | return; |
308 | } |
307 | } |
309 | |
308 | |
310 | if (ctx->repo && prepare_repo_cmd(ctx)) |
309 | if (ctx->repo && prepare_repo_cmd(ctx)) |
311 | return; |
310 | return; |
312 | |
311 | |
313 | if (cmd->want_layout) { |
312 | if (cmd->want_layout) { |
314 | cgit_print_http_headers(ctx); |
313 | cgit_print_http_headers(ctx); |
315 | cgit_print_docstart(ctx); |
314 | cgit_print_docstart(ctx); |
316 | cgit_print_pageheader(ctx); |
315 | cgit_print_pageheader(ctx); |
|