summaryrefslogtreecommitdiffabout
path: root/cgit.c
authorLars Hjemli <hjemli@gmail.com>2009-08-09 11:46:01 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-09 11:46:01 (UTC)
commitdb6303b58883c4417f5bcc0c1ee34fed6553dca3 (patch) (side-by-side diff)
treeef7775ade9eef57c5a878f9588fe545a7da2c952 /cgit.c
parent17e3ff42646f182911fd0e5d872082977538db9e (diff)
parent97b3d252629a8a3b9d356c2532dec7611438e4b9 (diff)
downloadcgit-db6303b58883c4417f5bcc0c1ee34fed6553dca3.zip
cgit-db6303b58883c4417f5bcc0c1ee34fed6553dca3.tar.gz
cgit-db6303b58883c4417f5bcc0c1ee34fed6553dca3.tar.bz2
Merge branch 'lh/plugins'
Conflicts: cgit.c cgit.h
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index aa1107a..dbec196 100644
--- a/cgit.c
+++ b/cgit.c
@@ -27,2 +27,17 @@ void add_mimetype(const char *name, const char *value)
+struct cgit_filter *new_filter(const char *cmd, int extra_args)
+{
+ struct cgit_filter *f;
+
+ if (!cmd || !cmd[0])
+ return NULL;
+
+ f = xmalloc(sizeof(struct cgit_filter));
+ f->cmd = xstrdup(cmd);
+ f->argv = xmalloc((2 + extra_args) * sizeof(char *));
+ f->argv[0] = f->cmd;
+ f->argv[1] = NULL;
+ return f;
+}
+
void config_cb(const char *name, const char *value)
@@ -87,2 +102,4 @@ void config_cb(const char *name, const char *value)
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"))
@@ -97,2 +114,4 @@ void config_cb(const char *name, const char *value)
ctx.cfg.max_commit_count = atoi(value);
+ else if (!strcmp(name, "source-filter"))
+ ctx.cfg.source_filter = new_filter(value, 1);
else if (!strcmp(name, "summary-log"))
@@ -141,2 +160,6 @@ void config_cb(const char *name, const char *value)
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) {