]> granicus.if.org Git - cgit/commitdiff
Add `strict-export` option
authorFelix Hanley <felix@seconddrawer.com.au>
Mon, 8 Nov 2010 18:41:13 +0000 (19:41 +0100)
committerLars Hjemli <hjemli@gmail.com>
Mon, 8 Nov 2010 18:41:13 +0000 (19:41 +0100)
This option is used to specify a filename which needs to be present in
the repositories found during `scan-path` processing. By setting this
option to 'git-daemon-export-ok', only repositories explicitly marked
for git daemon export will be included in the cgit configuration.

Signed-off-by: Felix Hanley <felix@seconddrawer.com.au>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
cgit.c
cgit.h
cgitrc.5.txt
scan-tree.c

diff --git a/cgit.c b/cgit.c
index 96900bb5afbc04f02c0e643b22175c78e3886197..412fbf0c32c4c0d2be3b0973ae5b5804c85059d6 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -121,6 +121,8 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.logo_link = xstrdup(value);
        else if (!strcmp(name, "module-link"))
                ctx.cfg.module_link = xstrdup(value);
+       else if (!strcmp(name, "strict-export"))
+               ctx.cfg.strict_export = xstrdup(value);
        else if (!strcmp(name, "virtual-root")) {
                ctx.cfg.virtual_root = trim_end(value, '/');
                if (!ctx.cfg.virtual_root && (!strcmp(value, "/")))
diff --git a/cgit.h b/cgit.h
index 8f5dd2a7f2046eaca5b7eda311efa093f6f0f664..a9896cf23cb2d72980df532ee9ae4f89e31499f5 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -176,6 +176,7 @@ struct cgit_config {
        char *script_name;
        char *section;
        char *virtual_root;
+       char *strict_export;
        int cache_size;
        int cache_dynamic_ttl;
        int cache_max_create_time;
index ce78d419debc78718a3633aced47ec16feedea1f..75b6584e90ab5b40c2342df411f819dd3aebb3d6 100644 (file)
@@ -317,6 +317,13 @@ summary-tags::
        Specifies the number of tags to display in the repository "summary"
        view. Default value: "10".
 
+strict-export::
+       Filename which, if specified, needs to be present within the repository
+       for cgit to allow access to that repository. This can be used to emulate
+       gitweb's EXPORT_OK and STRICT_EXPORT functionality and limit cgit's
+       repositories to match those exported by git-daemon. This option MUST come
+       before 'scan-path'.
+
 virtual-root::
        Url which, if specified, will be used as root for all cgit links. It
        will also cause cgit to generate 'virtual urls', i.e. urls like
index b5b50f332b812e4afcd7622a57d84bcf653959a6..a0e09ceac4212c1f8a07ca391d6bc67d6b0cb438 100644 (file)
@@ -81,6 +81,10 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
                        path, strerror(errno), errno);
                return;
        }
+
+       if (ctx.cfg.strict_export && stat(fmt("%s/%s", path, ctx.cfg.strict_export), &st))
+               return;
+
        if (!stat(fmt("%s/noweb", path), &st))
                return;