]> granicus.if.org Git - cgit/commitdiff
cgit: don't set vpath unless repo is set
authorJohn Keeping <john@keeping.me.uk>
Sun, 19 Feb 2017 12:02:37 +0000 (12:02 +0000)
committerLukas Fleischer <lfleischer@lfos.de>
Thu, 10 Aug 2017 13:15:57 +0000 (15:15 +0200)
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>
cgit.c

diff --git a/cgit.c b/cgit.c
index 1075753e15b4de5672aa8445fcc86ef4e7079a92..1dae4b8c39cf9e915f1375400c74ae392d1515e8 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -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;