about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJohn Keeping2017-02-19 12:02:37 +0000
committerJason A. Donenfeld2017-08-10 16:05:07 +0200
commit113f4b85886bc5eb6b319fd048623b8d43b7bce0 (patch)
treee82c10650e3b0b2c33d3ec955a3e44d853a5f431
parentparsing: clear query path before starting (diff)
downloadcgit-113f4b85886bc5eb6b319fd048623b8d43b7bce0.tar.gz
cgit-113f4b85886bc5eb6b319fd048623b8d43b7bce0.zip
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>
-rw-r--r--cgit.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cgit.c b/cgit.c index 1075753..1dae4b8 100644 --- a/cgit.c +++ b/cgit.c
@@ -726,18 +726,18 @@ static void process_request(void)
726 return; 726 return;
727 } 727 }
728 728
729 /* If cmd->want_vpath is set, assume ctx.qry.path contains a "virtual"
730 * in-project path limit to be made available at ctx.qry.vpath.
731 * Otherwise, no path limit is in effect (ctx.qry.vpath = NULL).
732 */
733 ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL;
734
735 if (cmd->want_repo && !ctx.repo) { 729 if (cmd->want_repo && !ctx.repo) {
736 cgit_print_error_page(400, "Bad request", 730 cgit_print_error_page(400, "Bad request",
737 "No repository selected"); 731 "No repository selected");
738 return; 732 return;
739 } 733 }
740 734
735 /* If cmd->want_vpath is set, assume ctx.qry.path contains a "virtual"
736 * in-project path limit to be made available at ctx.qry.vpath.
737 * Otherwise, no path limit is in effect (ctx.qry.vpath = NULL).
738 */
739 ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL;
740
741 if (ctx.repo && prepare_repo_cmd()) 741 if (ctx.repo && prepare_repo_cmd())
742 return; 742 return;
743 743