summaryrefslogtreecommitdiffabout
path: root/cgit.c
authorLars Hjemli <hjemli@gmail.com>2009-08-09 11:27:21 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-09 11:41:54 (UTC)
commit537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4 (patch) (unidiff)
tree73b1d25a96dd171c5503fae1fefc6a27a7d58683 /cgit.c
parente1782fff8a78b7f265432603351281ad2988bb40 (diff)
downloadcgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.zip
cgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.tar.gz
cgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.tar.bz2
Add 'about-filter' and 'repo.about-filter' options
These options can be used to execute a filter command on each about-page, both top-level and for each repository (repo.about-filter can be used to override the current about-filter). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index b3a98c1..cb1149d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -69,48 +69,50 @@ void config_cb(const char *name, const char *value)
69 else if (!strcmp(name, "noheader")) 69 else if (!strcmp(name, "noheader"))
70 ctx.cfg.noheader = atoi(value); 70 ctx.cfg.noheader = atoi(value);
71 else if (!strcmp(name, "snapshots")) 71 else if (!strcmp(name, "snapshots"))
72 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); 72 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
73 else if (!strcmp(name, "enable-index-links")) 73 else if (!strcmp(name, "enable-index-links"))
74 ctx.cfg.enable_index_links = atoi(value); 74 ctx.cfg.enable_index_links = atoi(value);
75 else if (!strcmp(name, "enable-log-filecount")) 75 else if (!strcmp(name, "enable-log-filecount"))
76 ctx.cfg.enable_log_filecount = atoi(value); 76 ctx.cfg.enable_log_filecount = atoi(value);
77 else if (!strcmp(name, "enable-log-linecount")) 77 else if (!strcmp(name, "enable-log-linecount"))
78 ctx.cfg.enable_log_linecount = atoi(value); 78 ctx.cfg.enable_log_linecount = atoi(value);
79 else if (!strcmp(name, "max-stats")) 79 else if (!strcmp(name, "max-stats"))
80 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); 80 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL);
81 else if (!strcmp(name, "cache-size")) 81 else if (!strcmp(name, "cache-size"))
82 ctx.cfg.cache_size = atoi(value); 82 ctx.cfg.cache_size = atoi(value);
83 else if (!strcmp(name, "cache-root")) 83 else if (!strcmp(name, "cache-root"))
84 ctx.cfg.cache_root = xstrdup(value); 84 ctx.cfg.cache_root = xstrdup(value);
85 else if (!strcmp(name, "cache-root-ttl")) 85 else if (!strcmp(name, "cache-root-ttl"))
86 ctx.cfg.cache_root_ttl = atoi(value); 86 ctx.cfg.cache_root_ttl = atoi(value);
87 else if (!strcmp(name, "cache-repo-ttl")) 87 else if (!strcmp(name, "cache-repo-ttl"))
88 ctx.cfg.cache_repo_ttl = atoi(value); 88 ctx.cfg.cache_repo_ttl = atoi(value);
89 else if (!strcmp(name, "cache-static-ttl")) 89 else if (!strcmp(name, "cache-static-ttl"))
90 ctx.cfg.cache_static_ttl = atoi(value); 90 ctx.cfg.cache_static_ttl = atoi(value);
91 else if (!strcmp(name, "cache-dynamic-ttl")) 91 else if (!strcmp(name, "cache-dynamic-ttl"))
92 ctx.cfg.cache_dynamic_ttl = atoi(value); 92 ctx.cfg.cache_dynamic_ttl = atoi(value);
93 else if (!strcmp(name, "about-filter"))
94 ctx.cfg.about_filter = new_filter(value, 0);
93 else if (!strcmp(name, "commit-filter")) 95 else if (!strcmp(name, "commit-filter"))
94 ctx.cfg.commit_filter = new_filter(value, 0); 96 ctx.cfg.commit_filter = new_filter(value, 0);
95 else if (!strcmp(name, "embedded")) 97 else if (!strcmp(name, "embedded"))
96 ctx.cfg.embedded = atoi(value); 98 ctx.cfg.embedded = atoi(value);
97 else if (!strcmp(name, "max-message-length")) 99 else if (!strcmp(name, "max-message-length"))
98 ctx.cfg.max_msg_len = atoi(value); 100 ctx.cfg.max_msg_len = atoi(value);
99 else if (!strcmp(name, "max-repodesc-length")) 101 else if (!strcmp(name, "max-repodesc-length"))
100 ctx.cfg.max_repodesc_len = atoi(value); 102 ctx.cfg.max_repodesc_len = atoi(value);
101 else if (!strcmp(name, "max-repo-count")) 103 else if (!strcmp(name, "max-repo-count"))
102 ctx.cfg.max_repo_count = atoi(value); 104 ctx.cfg.max_repo_count = atoi(value);
103 else if (!strcmp(name, "max-commit-count")) 105 else if (!strcmp(name, "max-commit-count"))
104 ctx.cfg.max_commit_count = atoi(value); 106 ctx.cfg.max_commit_count = atoi(value);
105 else if (!strcmp(name, "source-filter")) 107 else if (!strcmp(name, "source-filter"))
106 ctx.cfg.source_filter = new_filter(value, 1); 108 ctx.cfg.source_filter = new_filter(value, 1);
107 else if (!strcmp(name, "summary-log")) 109 else if (!strcmp(name, "summary-log"))
108 ctx.cfg.summary_log = atoi(value); 110 ctx.cfg.summary_log = atoi(value);
109 else if (!strcmp(name, "summary-branches")) 111 else if (!strcmp(name, "summary-branches"))
110 ctx.cfg.summary_branches = atoi(value); 112 ctx.cfg.summary_branches = atoi(value);
111 else if (!strcmp(name, "summary-tags")) 113 else if (!strcmp(name, "summary-tags"))
112 ctx.cfg.summary_tags = atoi(value); 114 ctx.cfg.summary_tags = atoi(value);
113 else if (!strcmp(name, "agefile")) 115 else if (!strcmp(name, "agefile"))
114 ctx.cfg.agefile = xstrdup(value); 116 ctx.cfg.agefile = xstrdup(value);
115 else if (!strcmp(name, "renamelimit")) 117 else if (!strcmp(name, "renamelimit"))
116 ctx.cfg.renamelimit = atoi(value); 118 ctx.cfg.renamelimit = atoi(value);
@@ -125,48 +127,50 @@ void config_cb(const char *name, const char *value)
125 else if (!strcmp(name, "repo.url")) 127 else if (!strcmp(name, "repo.url"))
126 ctx.repo = cgit_add_repo(value); 128 ctx.repo = cgit_add_repo(value);
127 else if (!strcmp(name, "repo.name")) 129 else if (!strcmp(name, "repo.name"))
128 ctx.repo->name = xstrdup(value); 130 ctx.repo->name = xstrdup(value);
129 else if (ctx.repo && !strcmp(name, "repo.path")) 131 else if (ctx.repo && !strcmp(name, "repo.path"))
130 ctx.repo->path = trim_end(value, '/'); 132 ctx.repo->path = trim_end(value, '/');
131 else if (ctx.repo && !strcmp(name, "repo.clone-url")) 133 else if (ctx.repo && !strcmp(name, "repo.clone-url"))
132 ctx.repo->clone_url = xstrdup(value); 134 ctx.repo->clone_url = xstrdup(value);
133 else if (ctx.repo && !strcmp(name, "repo.desc")) 135 else if (ctx.repo && !strcmp(name, "repo.desc"))
134 ctx.repo->desc = xstrdup(value); 136 ctx.repo->desc = xstrdup(value);
135 else if (ctx.repo && !strcmp(name, "repo.owner")) 137 else if (ctx.repo && !strcmp(name, "repo.owner"))
136 ctx.repo->owner = xstrdup(value); 138 ctx.repo->owner = xstrdup(value);
137 else if (ctx.repo && !strcmp(name, "repo.defbranch")) 139 else if (ctx.repo && !strcmp(name, "repo.defbranch"))
138 ctx.repo->defbranch = xstrdup(value); 140 ctx.repo->defbranch = xstrdup(value);
139 else if (ctx.repo && !strcmp(name, "repo.snapshots")) 141 else if (ctx.repo && !strcmp(name, "repo.snapshots"))
140 ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ 142 ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */
141 else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount")) 143 else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount"))
142 ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); 144 ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value);
143 else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount")) 145 else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount"))
144 ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); 146 ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
145 else if (ctx.repo && !strcmp(name, "repo.max-stats")) 147 else if (ctx.repo && !strcmp(name, "repo.max-stats"))
146 ctx.repo->max_stats = cgit_find_stats_period(value, NULL); 148 ctx.repo->max_stats = cgit_find_stats_period(value, NULL);
147 else if (ctx.repo && !strcmp(name, "repo.module-link")) 149 else if (ctx.repo && !strcmp(name, "repo.module-link"))
148 ctx.repo->module_link= xstrdup(value); 150 ctx.repo->module_link= xstrdup(value);
151 else if (ctx.repo && !strcmp(name, "repo.about-filter"))
152 ctx.repo->about_filter = new_filter(value, 0);
149 else if (ctx.repo && !strcmp(name, "repo.commit-filter")) 153 else if (ctx.repo && !strcmp(name, "repo.commit-filter"))
150 ctx.repo->commit_filter = new_filter(value, 0); 154 ctx.repo->commit_filter = new_filter(value, 0);
151 else if (ctx.repo && !strcmp(name, "repo.source-filter")) 155 else if (ctx.repo && !strcmp(name, "repo.source-filter"))
152 ctx.repo->source_filter = new_filter(value, 1); 156 ctx.repo->source_filter = new_filter(value, 1);
153 else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { 157 else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) {
154 if (*value == '/') 158 if (*value == '/')
155 ctx.repo->readme = xstrdup(value); 159 ctx.repo->readme = xstrdup(value);
156 else 160 else
157 ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value)); 161 ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value));
158 } else if (!strcmp(name, "include")) 162 } else if (!strcmp(name, "include"))
159 parse_configfile(value, config_cb); 163 parse_configfile(value, config_cb);
160} 164}
161 165
162static void querystring_cb(const char *name, const char *value) 166static void querystring_cb(const char *name, const char *value)
163{ 167{
164 if (!strcmp(name,"r")) { 168 if (!strcmp(name,"r")) {
165 ctx.qry.repo = xstrdup(value); 169 ctx.qry.repo = xstrdup(value);
166 ctx.repo = cgit_get_repoinfo(value); 170 ctx.repo = cgit_get_repoinfo(value);
167 } else if (!strcmp(name, "p")) { 171 } else if (!strcmp(name, "p")) {
168 ctx.qry.page = xstrdup(value); 172 ctx.qry.page = xstrdup(value);
169 } else if (!strcmp(name, "url")) { 173 } else if (!strcmp(name, "url")) {
170 ctx.qry.url = xstrdup(value); 174 ctx.qry.url = xstrdup(value);
171 cgit_parse_url(value); 175 cgit_parse_url(value);
172 } else if (!strcmp(name, "qt")) { 176 } else if (!strcmp(name, "qt")) {