aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2009-08-09 20:46:01 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2009-08-09 20:46:01 (JST)
commitdb6303b58883c4417f5bcc0c1ee34fed6553dca3 (patch)
treeef7775ade9eef57c5a878f9588fe545a7da2c952 /cgit.c
parent17e3ff42646f182911fd0e5d872082977538db9e (diff)
parent97b3d252629a8a3b9d356c2532dec7611438e4b9 (diff)
downloadcgit-db6303b58883c4417f5bcc0c1ee34fed6553dca3.zip
cgit-db6303b58883c4417f5bcc0c1ee34fed6553dca3.tar.gz
Merge branch 'lh/plugins'
Conflicts: cgit.c cgit.h
Diffstat (limited to 'cgit.c')
-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
@@ -25,6 +25,21 @@ void add_mimetype(const char *name, const char *value)
25 item->util = xstrdup(value); 25 item->util = xstrdup(value);
26} 26}
27 27
28struct cgit_filter *new_filter(const char *cmd, int extra_args)
29{
30 struct cgit_filter *f;
31
32 if (!cmd || !cmd[0])
33 return NULL;
34
35 f = xmalloc(sizeof(struct cgit_filter));
36 f->cmd = xstrdup(cmd);
37 f->argv = xmalloc((2 + extra_args) * sizeof(char *));
38 f->argv[0] = f->cmd;
39 f->argv[1] = NULL;
40 return f;
41}
42
28void config_cb(const char *name, const char *value) 43void config_cb(const char *name, const char *value)
29{ 44{
30 if (!strcmp(name, "root-title")) 45 if (!strcmp(name, "root-title"))
@@ -85,6 +100,8 @@ void config_cb(const char *name, const char *value)
85 ctx.cfg.cache_static_ttl = atoi(value); 100 ctx.cfg.cache_static_ttl = atoi(value);
86 else if (!strcmp(name, "cache-dynamic-ttl")) 101 else if (!strcmp(name, "cache-dynamic-ttl"))
87 ctx.cfg.cache_dynamic_ttl = atoi(value); 102 ctx.cfg.cache_dynamic_ttl = atoi(value);
103 else if (!strcmp(name, "commit-filter"))
104 ctx.cfg.commit_filter = new_filter(value, 0);
88 else if (!strcmp(name, "embedded")) 105 else if (!strcmp(name, "embedded"))
89 ctx.cfg.embedded = atoi(value); 106 ctx.cfg.embedded = atoi(value);
90 else if (!strcmp(name, "max-message-length")) 107 else if (!strcmp(name, "max-message-length"))
@@ -95,6 +112,8 @@ void config_cb(const char *name, const char *value)
95 ctx.cfg.max_repo_count = atoi(value); 112 ctx.cfg.max_repo_count = atoi(value);
96 else if (!strcmp(name, "max-commit-count")) 113 else if (!strcmp(name, "max-commit-count"))
97 ctx.cfg.max_commit_count = atoi(value); 114 ctx.cfg.max_commit_count = atoi(value);
115 else if (!strcmp(name, "source-filter"))
116 ctx.cfg.source_filter = new_filter(value, 1);
98 else if (!strcmp(name, "summary-log")) 117 else if (!strcmp(name, "summary-log"))
99 ctx.cfg.summary_log = atoi(value); 118 ctx.cfg.summary_log = atoi(value);
100 else if (!strcmp(name, "summary-branches")) 119 else if (!strcmp(name, "summary-branches"))
@@ -139,6 +158,10 @@ void config_cb(const char *name, const char *value)
139 ctx.repo->max_stats = cgit_find_stats_period(value, NULL); 158 ctx.repo->max_stats = cgit_find_stats_period(value, NULL);
140 else if (ctx.repo && !strcmp(name, "repo.module-link")) 159 else if (ctx.repo && !strcmp(name, "repo.module-link"))
141 ctx.repo->module_link= xstrdup(value); 160 ctx.repo->module_link= xstrdup(value);
161 else if (ctx.repo && !strcmp(name, "repo.commit-filter"))
162 ctx.repo->commit_filter = new_filter(value, 0);
163 else if (ctx.repo && !strcmp(name, "repo.source-filter"))
164 ctx.repo->source_filter = new_filter(value, 1);
142 else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { 165 else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) {
143 if (*value == '/') 166 if (*value == '/')
144 ctx.repo->readme = xstrdup(value); 167 ctx.repo->readme = xstrdup(value);