|
diff --git a/cgit.c b/cgit.c index 2cda554..fd341b8 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -101,96 +101,100 @@ void config_cb(const char *name, const char *value) |
101 | else if (!strcmp(name, "max-repo-count")) |
101 | else if (!strcmp(name, "max-repo-count")) |
102 | ctx.cfg.max_repo_count = atoi(value); |
102 | ctx.cfg.max_repo_count = atoi(value); |
103 | else if (!strcmp(name, "max-commit-count")) |
103 | else if (!strcmp(name, "max-commit-count")) |
104 | ctx.cfg.max_commit_count = atoi(value); |
104 | ctx.cfg.max_commit_count = atoi(value); |
105 | else if (!strcmp(name, "source-filter")) |
105 | else if (!strcmp(name, "source-filter")) |
106 | ctx.cfg.source_filter = new_filter(value, 1); |
106 | ctx.cfg.source_filter = new_filter(value, 1); |
107 | else if (!strcmp(name, "summary-log")) |
107 | else if (!strcmp(name, "summary-log")) |
108 | ctx.cfg.summary_log = atoi(value); |
108 | ctx.cfg.summary_log = atoi(value); |
109 | else if (!strcmp(name, "summary-branches")) |
109 | else if (!strcmp(name, "summary-branches")) |
110 | ctx.cfg.summary_branches = atoi(value); |
110 | ctx.cfg.summary_branches = atoi(value); |
111 | else if (!strcmp(name, "summary-tags")) |
111 | else if (!strcmp(name, "summary-tags")) |
112 | ctx.cfg.summary_tags = atoi(value); |
112 | ctx.cfg.summary_tags = atoi(value); |
113 | else if (!strcmp(name, "agefile")) |
113 | else if (!strcmp(name, "agefile")) |
114 | ctx.cfg.agefile = xstrdup(value); |
114 | ctx.cfg.agefile = xstrdup(value); |
115 | else if (!strcmp(name, "renamelimit")) |
115 | else if (!strcmp(name, "renamelimit")) |
116 | ctx.cfg.renamelimit = atoi(value); |
116 | ctx.cfg.renamelimit = atoi(value); |
117 | else if (!strcmp(name, "robots")) |
117 | else if (!strcmp(name, "robots")) |
118 | ctx.cfg.robots = xstrdup(value); |
118 | ctx.cfg.robots = xstrdup(value); |
119 | else if (!strcmp(name, "clone-prefix")) |
119 | else if (!strcmp(name, "clone-prefix")) |
120 | ctx.cfg.clone_prefix = xstrdup(value); |
120 | ctx.cfg.clone_prefix = xstrdup(value); |
121 | else if (!strcmp(name, "local-time")) |
121 | else if (!strcmp(name, "local-time")) |
122 | ctx.cfg.local_time = atoi(value); |
122 | ctx.cfg.local_time = atoi(value); |
123 | else if (!strcmp(name, "repo.group")) |
123 | else if (!strcmp(name, "repo.group")) |
124 | ctx.cfg.repo_group = xstrdup(value); |
124 | ctx.cfg.repo_group = xstrdup(value); |
125 | else if (!strcmp(name, "repo.url")) |
125 | else if (!strcmp(name, "repo.url")) |
126 | ctx.repo = cgit_add_repo(value); |
126 | ctx.repo = cgit_add_repo(value); |
127 | else if (!strcmp(name, "repo.name")) |
127 | else if (!strcmp(name, "repo.name")) |
128 | ctx.repo->name = xstrdup(value); |
128 | ctx.repo->name = xstrdup(value); |
129 | else if (ctx.repo && !strcmp(name, "repo.path")) |
129 | else if (ctx.repo && !strcmp(name, "repo.path")) |
130 | ctx.repo->path = trim_end(value, '/'); |
130 | ctx.repo->path = trim_end(value, '/'); |
131 | else if (ctx.repo && !strcmp(name, "repo.clone-url")) |
131 | else if (ctx.repo && !strcmp(name, "repo.clone-url")) |
132 | ctx.repo->clone_url = xstrdup(value); |
132 | ctx.repo->clone_url = xstrdup(value); |
133 | else if (ctx.repo && !strcmp(name, "repo.desc")) |
133 | else if (ctx.repo && !strcmp(name, "repo.desc")) |
134 | ctx.repo->desc = xstrdup(value); |
134 | ctx.repo->desc = xstrdup(value); |
135 | else if (ctx.repo && !strcmp(name, "repo.owner")) |
135 | else if (ctx.repo && !strcmp(name, "repo.owner")) |
136 | ctx.repo->owner = xstrdup(value); |
136 | ctx.repo->owner = xstrdup(value); |
137 | else if (ctx.repo && !strcmp(name, "repo.defbranch")) |
137 | else if (ctx.repo && !strcmp(name, "repo.defbranch")) |
138 | ctx.repo->defbranch = xstrdup(value); |
138 | ctx.repo->defbranch = xstrdup(value); |
139 | else if (ctx.repo && !strcmp(name, "repo.snapshots")) |
139 | else if (ctx.repo && !strcmp(name, "repo.snapshots")) |
140 | ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ |
140 | ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ |
141 | else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount")) |
141 | else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount")) |
142 | ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
142 | ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
143 | else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount")) |
143 | else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount")) |
144 | ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
144 | ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
145 | else if (ctx.repo && !strcmp(name, "repo.max-stats")) |
145 | else if (ctx.repo && !strcmp(name, "repo.max-stats")) |
146 | ctx.repo->max_stats = cgit_find_stats_period(value, NULL); |
146 | ctx.repo->max_stats = cgit_find_stats_period(value, NULL); |
147 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
147 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
148 | ctx.repo->module_link= xstrdup(value); |
148 | ctx.repo->module_link= xstrdup(value); |
| |
149 | else if (ctx.repo && !strcmp(name, "repo.commit-filter")) |
| |
150 | ctx.repo->commit_filter = new_filter(value, 0); |
| |
151 | else if (ctx.repo && !strcmp(name, "repo.source-filter")) |
| |
152 | ctx.repo->source_filter = new_filter(value, 1); |
149 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
153 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
150 | if (*value == '/') |
154 | if (*value == '/') |
151 | ctx.repo->readme = xstrdup(value); |
155 | ctx.repo->readme = xstrdup(value); |
152 | else |
156 | else |
153 | ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value)); |
157 | ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value)); |
154 | } else if (!strcmp(name, "include")) |
158 | } else if (!strcmp(name, "include")) |
155 | parse_configfile(value, config_cb); |
159 | parse_configfile(value, config_cb); |
156 | } |
160 | } |
157 | |
161 | |
158 | static void querystring_cb(const char *name, const char *value) |
162 | static void querystring_cb(const char *name, const char *value) |
159 | { |
163 | { |
160 | if (!strcmp(name,"r")) { |
164 | if (!strcmp(name,"r")) { |
161 | ctx.qry.repo = xstrdup(value); |
165 | ctx.qry.repo = xstrdup(value); |
162 | ctx.repo = cgit_get_repoinfo(value); |
166 | ctx.repo = cgit_get_repoinfo(value); |
163 | } else if (!strcmp(name, "p")) { |
167 | } else if (!strcmp(name, "p")) { |
164 | ctx.qry.page = xstrdup(value); |
168 | ctx.qry.page = xstrdup(value); |
165 | } else if (!strcmp(name, "url")) { |
169 | } else if (!strcmp(name, "url")) { |
166 | ctx.qry.url = xstrdup(value); |
170 | ctx.qry.url = xstrdup(value); |
167 | cgit_parse_url(value); |
171 | cgit_parse_url(value); |
168 | } else if (!strcmp(name, "qt")) { |
172 | } else if (!strcmp(name, "qt")) { |
169 | ctx.qry.grep = xstrdup(value); |
173 | ctx.qry.grep = xstrdup(value); |
170 | } else if (!strcmp(name, "q")) { |
174 | } else if (!strcmp(name, "q")) { |
171 | ctx.qry.search = xstrdup(value); |
175 | ctx.qry.search = xstrdup(value); |
172 | } else if (!strcmp(name, "h")) { |
176 | } else if (!strcmp(name, "h")) { |
173 | ctx.qry.head = xstrdup(value); |
177 | ctx.qry.head = xstrdup(value); |
174 | ctx.qry.has_symref = 1; |
178 | ctx.qry.has_symref = 1; |
175 | } else if (!strcmp(name, "id")) { |
179 | } else if (!strcmp(name, "id")) { |
176 | ctx.qry.sha1 = xstrdup(value); |
180 | ctx.qry.sha1 = xstrdup(value); |
177 | ctx.qry.has_sha1 = 1; |
181 | ctx.qry.has_sha1 = 1; |
178 | } else if (!strcmp(name, "id2")) { |
182 | } else if (!strcmp(name, "id2")) { |
179 | ctx.qry.sha2 = xstrdup(value); |
183 | ctx.qry.sha2 = xstrdup(value); |
180 | ctx.qry.has_sha1 = 1; |
184 | ctx.qry.has_sha1 = 1; |
181 | } else if (!strcmp(name, "ofs")) { |
185 | } else if (!strcmp(name, "ofs")) { |
182 | ctx.qry.ofs = atoi(value); |
186 | ctx.qry.ofs = atoi(value); |
183 | } else if (!strcmp(name, "path")) { |
187 | } else if (!strcmp(name, "path")) { |
184 | ctx.qry.path = trim_end(value, '/'); |
188 | ctx.qry.path = trim_end(value, '/'); |
185 | } else if (!strcmp(name, "name")) { |
189 | } else if (!strcmp(name, "name")) { |
186 | ctx.qry.name = xstrdup(value); |
190 | ctx.qry.name = xstrdup(value); |
187 | } else if (!strcmp(name, "mimetype")) { |
191 | } else if (!strcmp(name, "mimetype")) { |
188 | ctx.qry.mimetype = xstrdup(value); |
192 | ctx.qry.mimetype = xstrdup(value); |
189 | } else if (!strcmp(name, "s")){ |
193 | } else if (!strcmp(name, "s")){ |
190 | ctx.qry.sort = xstrdup(value); |
194 | ctx.qry.sort = xstrdup(value); |
191 | } else if (!strcmp(name, "showmsg")) { |
195 | } else if (!strcmp(name, "showmsg")) { |
192 | ctx.qry.showmsg = atoi(value); |
196 | ctx.qry.showmsg = atoi(value); |
193 | } else if (!strcmp(name, "period")) { |
197 | } else if (!strcmp(name, "period")) { |
194 | ctx.qry.period = xstrdup(value); |
198 | ctx.qry.period = xstrdup(value); |
195 | } |
199 | } |
196 | } |
200 | } |
|