cgit: don't set vpath unless repo is set

After the previous two patches, this can be classified as a tidy up
rather than a bug fix, but I think it makes sense to group all of the
tests together before setting up the environment for the command to
execute.

Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
John Keeping 2017-02-19 12:02:37 +00:00 committed by Jason A. Donenfeld
부모 c699866699
커밋 113f4b8588

12
cgit.c
파일 보기

@ -726,18 +726,18 @@ static void process_request(void)
return; return;
} }
/* If cmd->want_vpath is set, assume ctx.qry.path contains a "virtual"
* in-project path limit to be made available at ctx.qry.vpath.
* Otherwise, no path limit is in effect (ctx.qry.vpath = NULL).
*/
ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL;
if (cmd->want_repo && !ctx.repo) { if (cmd->want_repo && !ctx.repo) {
cgit_print_error_page(400, "Bad request", cgit_print_error_page(400, "Bad request",
"No repository selected"); "No repository selected");
return; return;
} }
/* If cmd->want_vpath is set, assume ctx.qry.path contains a "virtual"
* in-project path limit to be made available at ctx.qry.vpath.
* Otherwise, no path limit is in effect (ctx.qry.vpath = NULL).
*/
ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL;
if (ctx.repo && prepare_repo_cmd()) if (ctx.repo && prepare_repo_cmd())
return; return;