]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Merge branch 'stable'
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 38bc136596ce610cfe6cb08450658ecee5e590ca..c2638727b629438d89cb0f3d7efa851ae1779a36 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -152,7 +152,7 @@ void config_cb(const char *name, const char *value)
        else if (!strcmp(name, "cache-size"))
                ctx.cfg.cache_size = atoi(value);
        else if (!strcmp(name, "cache-root"))
        else if (!strcmp(name, "cache-size"))
                ctx.cfg.cache_size = atoi(value);
        else if (!strcmp(name, "cache-root"))
-               ctx.cfg.cache_root = xstrdup(value);
+               ctx.cfg.cache_root = xstrdup(expand_macros(value));
        else if (!strcmp(name, "cache-root-ttl"))
                ctx.cfg.cache_root_ttl = atoi(value);
        else if (!strcmp(name, "cache-repo-ttl"))
        else if (!strcmp(name, "cache-root-ttl"))
                ctx.cfg.cache_root_ttl = atoi(value);
        else if (!strcmp(name, "cache-repo-ttl"))
@@ -183,9 +183,9 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.max_commit_count = atoi(value);
        else if (!strcmp(name, "scan-path"))
                if (!ctx.cfg.nocache && ctx.cfg.cache_size)
                ctx.cfg.max_commit_count = atoi(value);
        else if (!strcmp(name, "scan-path"))
                if (!ctx.cfg.nocache && ctx.cfg.cache_size)
-                       process_cached_repolist(value);
+                       process_cached_repolist(expand_macros(value));
                else
                else
-                       scan_tree(value, repo_config);
+                       scan_tree(expand_macros(value), repo_config);
        else if (!strcmp(name, "source-filter"))
                ctx.cfg.source_filter = new_filter(value, 1);
        else if (!strcmp(name, "summary-log"))
        else if (!strcmp(name, "source-filter"))
                ctx.cfg.source_filter = new_filter(value, 1);
        else if (!strcmp(name, "summary-log"))
@@ -209,7 +209,7 @@ void config_cb(const char *name, const char *value)
        else if (!prefixcmp(name, "mimetype."))
                add_mimetype(name + 9, value);
        else if (!strcmp(name, "include"))
        else if (!prefixcmp(name, "mimetype."))
                add_mimetype(name + 9, value);
        else if (!strcmp(name, "include"))
-               parse_configfile(value, config_cb);
+               parse_configfile(expand_macros(value), config_cb);
 }
 
 static void querystring_cb(const char *name, const char *value)
 }
 
 static void querystring_cb(const char *name, const char *value)
@@ -258,6 +258,10 @@ static void querystring_cb(const char *name, const char *value)
                ctx.qry.ssdiff = atoi(value);
        } else if (!strcmp(name, "all")) {
                ctx.qry.show_all = atoi(value);
                ctx.qry.ssdiff = atoi(value);
        } else if (!strcmp(name, "all")) {
                ctx.qry.show_all = atoi(value);
+       } else if (!strcmp(name, "context")) {
+               ctx.qry.context = atoi(value);
+       } else if (!strcmp(name, "ignorews")) {
+               ctx.qry.ignorews = atoi(value);
        }
 }
 
        }
 }
 
@@ -433,6 +437,12 @@ static void process_request(void *cbdata)
                return;
        }
 
                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);
        if (cmd->want_repo && !ctx->repo) {
                cgit_print_http_headers(ctx);
                cgit_print_docstart(ctx);
@@ -697,7 +707,7 @@ int main(int argc, const char **argv)
        cgit_repolist.repos = NULL;
 
        cgit_parse_args(argc, argv);
        cgit_repolist.repos = NULL;
 
        cgit_parse_args(argc, argv);
-       parse_configfile(ctx.env.cgit_config, config_cb);
+       parse_configfile(expand_macros(ctx.env.cgit_config), config_cb);
        ctx.repo = NULL;
        http_parse_querystring(ctx.qry.raw, querystring_cb);
 
        ctx.repo = NULL;
        http_parse_querystring(ctx.qry.raw, querystring_cb);