]> git.cameronkatri.com Git - cgit.git/blobdiff - cgit.c
cgit.c: allow repo.*-filter options to unset the current default
[cgit.git] / cgit.c
diff --git a/cgit.c b/cgit.c
index eb7b45d5e77f897276a3765b09124723e245439b..b3a98c1599ff8971d9af03a0ca8ea1a1b6d8abb0 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -21,7 +21,7 @@ struct cgit_filter *new_filter(const char *cmd, int extra_args)
 {
        struct cgit_filter *f;
 
-       if (!cmd)
+       if (!cmd || !cmd[0])
                return NULL;
 
        f = xmalloc(sizeof(struct cgit_filter));
@@ -90,6 +90,8 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.cache_static_ttl = atoi(value);
        else if (!strcmp(name, "cache-dynamic-ttl"))
                ctx.cfg.cache_dynamic_ttl = atoi(value);
+       else if (!strcmp(name, "commit-filter"))
+               ctx.cfg.commit_filter = new_filter(value, 0);
        else if (!strcmp(name, "embedded"))
                ctx.cfg.embedded = atoi(value);
        else if (!strcmp(name, "max-message-length"))
@@ -144,6 +146,10 @@ void config_cb(const char *name, const char *value)
                ctx.repo->max_stats = cgit_find_stats_period(value, NULL);
        else if (ctx.repo && !strcmp(name, "repo.module-link"))
                ctx.repo->module_link= xstrdup(value);
+       else if (ctx.repo && !strcmp(name, "repo.commit-filter"))
+               ctx.repo->commit_filter = new_filter(value, 0);
+       else if (ctx.repo && !strcmp(name, "repo.source-filter"))
+               ctx.repo->source_filter = new_filter(value, 1);
        else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) {
                if (*value == '/')
                        ctx.repo->readme = xstrdup(value);