]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Add URL parameter 'context' for changing the number of context lines in diffs
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 9305d0a873a191e730d622d14067a2eee56003a6..e9bafb506ef38c24c4b4300de08d0b5965a738f6 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -250,6 +250,8 @@ static void querystring_cb(const char *name, const char *value)
                ctx.qry.period = xstrdup(value);
        } else if (!strcmp(name, "ss")) {
                ctx.qry.ssdiff = atoi(value);
+       } else if (!strcmp(name, "context")) {
+               ctx.qry.context = atoi(value);
        }
 }
 
@@ -424,6 +426,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);