From 0ff143df7043b7dd87c31c50fa875bc96d1a7779 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Thu, 10 Jun 2010 01:09:26 +0200 Subject: struct cgit_cmd: Differentiate between various usages of ctx.qry.path For many commands/pages (e.g. 'tree', 'diff', 'plain', etc.), the ctx.qry.path argument is interpreted as a path within the "virtual" project directory structure. However, for some other commands (notably 'refs', and the clone-related commands) ctx.qry.path is used in a different context (as a more or less "real" path within the '.git' directory). This patch differentiates between these two usages of ctx.qry.path, by introducing a new variable - ctx.qry.vpath - which is equal to ctx.qry.path in the former case, and NULL in the latter. This will become useful in future patches when we want various pages and the links between them to preserve existing in-project paths. Signed-off-by: Johan Herland Signed-off-by: Lars Hjemli --- cgit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cgit.c') diff --git a/cgit.c b/cgit.c index 9305d0a..2c3ad73 100644 --- a/cgit.c +++ b/cgit.c @@ -424,6 +424,12 @@ static void process_request(void *cbdata) 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_http_headers(ctx); cgit_print_docstart(ctx); -- cgit v1.2.1