Skip to content

Commit

Permalink
cgit: don't set vpath unless repo is set
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
johnkeeping authored and zx2c4 committed Aug 10, 2017
1 parent c699866 commit 113f4b8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cgit.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,18 +726,18 @@ static void process_request(void)
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) {
cgit_print_error_page(400, "Bad request",
"No repository selected");
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())
return;

Expand Down

0 comments on commit 113f4b8

Please sign in to comment.