]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Re-enable 'index-info' and add support for 'root-desc' in cgitrc
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 763242abc4258779fe5daa0ed8cec8c6bcb3bc43..bbde64b04ad566b8c7bc44a3f953bb979ffa3f41 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -19,6 +19,8 @@ void config_cb(const char *name, const char *value)
 {
        if (!strcmp(name, "root-title"))
                ctx.cfg.root_title = xstrdup(value);
+       else if (!strcmp(name, "root-desc"))
+               ctx.cfg.root_desc = xstrdup(value);
        else if (!strcmp(name, "css"))
                ctx.cfg.css = xstrdup(value);
        else if (!strcmp(name, "logo"))
@@ -159,6 +161,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->cfg.renamelimit = -1;
        ctx->cfg.robots = "index, nofollow";
        ctx->cfg.root_title = "Git repository browser";
+       ctx->cfg.root_desc = "a fast webinterface for the git dscm";
        ctx->cfg.script_name = CGIT_SCRIPT_NAME;
        ctx->page.mimetype = "text/html";
        ctx->page.charset = PAGE_ENCODING;
@@ -179,7 +182,9 @@ static int cgit_prepare_cache(struct cacheitem *item)
        }
 
        if (!ctx.repo) {
-               item->name = xstrdup(fmt("%s/index.html", ctx.cfg.cache_root));
+               item->name = xstrdup(fmt("%s/index.%s.html",
+                                        ctx.cfg.cache_root,
+                                        cache_safe_filename(ctx.qry.raw)));
                item->ttl = ctx.cfg.cache_root_ttl;
                return 1;
        }
@@ -440,6 +445,7 @@ int main(int argc, const char **argv)
 
        parse_configfile(cgit_config_env ? cgit_config_env : CGIT_CONFIG,
                         config_cb);
+       ctx.repo = NULL;
        if (getenv("SCRIPT_NAME"))
                ctx.cfg.script_name = xstrdup(getenv("SCRIPT_NAME"));
        if (getenv("QUERY_STRING"))