]> granicus.if.org Git - cgit/commitdiff
Set GIT_NAMESPACE when repo.namespace is provided
authorRichard Maw <richard.maw@gmail.com>
Sat, 25 Jun 2016 19:51:36 +0000 (20:51 +0100)
committerRichard Maw <richard.maw@gmail.com>
Wed, 13 Jul 2016 19:09:37 +0000 (20:09 +0100)
This causes any namespace-aware code
to only handle refs under that namespace.

Currently this doesn't do much
as the only namespace aware code is in recieve-pack and upload-pack,
which are not handled by CGit.

Signed-off-by: Richard Maw <richard.maw@gmail.com>
cgit.c

diff --git a/cgit.c b/cgit.c
index 9b2733bb1f4b30591bb33430801651ad4d60e3be..eae2f3443e35825d9535762a1d381fc11b295e93 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -566,6 +566,11 @@ static int prepare_repo_cmd(void)
        /* The path to the git repository. */
        setenv("GIT_DIR", ctx.repo->path, 1);
 
+       /*  Set the namespace in the environment,
+        *  so it gets loaded on the first get_git_namespace() */
+       if (ctx.repo->namespace)
+               setenv("GIT_NAMESPACE", ctx.repo->namespace, 1);
+
        /* Do not look in /etc/ for gitconfig and gitattributes. */
        setenv("GIT_CONFIG_NOSYSTEM", "1", 1);
        setenv("GIT_ATTR_NOSYSTEM", "1", 1);