[PATCH 3/3] cgit: don't set vpath unless repo is set

John Keeping john at keeping.me.uk
Sun Feb 19 13:45:01 CET 2017


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 at keeping.me.uk>
---
 cgit.c | 12 ++++++------
 1 file 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)
 		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;
 
-- 
2.12.0.rc2.230.ga28edc07cd



More information about the CGit mailing list