-rw-r--r-- | cgit.c | 3 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
-rw-r--r-- | cmd.c | 2 |
4 files changed, 9 insertions, 1 deletions
@@ -120,96 +120,98 @@ void config_cb(const char *name, const char *value) | |||
120 | else if (!strcmp(name, "module-link")) | 120 | else if (!strcmp(name, "module-link")) |
121 | ctx.cfg.module_link = xstrdup(value); | 121 | ctx.cfg.module_link = xstrdup(value); |
122 | else if (!strcmp(name, "virtual-root")) { | 122 | else if (!strcmp(name, "virtual-root")) { |
123 | ctx.cfg.virtual_root = trim_end(value, '/'); | 123 | ctx.cfg.virtual_root = trim_end(value, '/'); |
124 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) | 124 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) |
125 | ctx.cfg.virtual_root = ""; | 125 | ctx.cfg.virtual_root = ""; |
126 | } else if (!strcmp(name, "nocache")) | 126 | } else if (!strcmp(name, "nocache")) |
127 | ctx.cfg.nocache = atoi(value); | 127 | ctx.cfg.nocache = atoi(value); |
128 | else if (!strcmp(name, "noplainemail")) | 128 | else if (!strcmp(name, "noplainemail")) |
129 | ctx.cfg.noplainemail = atoi(value); | 129 | ctx.cfg.noplainemail = atoi(value); |
130 | else if (!strcmp(name, "noheader")) | 130 | else if (!strcmp(name, "noheader")) |
131 | ctx.cfg.noheader = atoi(value); | 131 | ctx.cfg.noheader = atoi(value); |
132 | else if (!strcmp(name, "snapshots")) | 132 | else if (!strcmp(name, "snapshots")) |
133 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); | 133 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
134 | else if (!strcmp(name, "enable-filter-overrides")) | 134 | else if (!strcmp(name, "enable-filter-overrides")) |
135 | ctx.cfg.enable_filter_overrides = atoi(value); | 135 | ctx.cfg.enable_filter_overrides = atoi(value); |
136 | else if (!strcmp(name, "enable-index-links")) | 136 | else if (!strcmp(name, "enable-index-links")) |
137 | ctx.cfg.enable_index_links = atoi(value); | 137 | ctx.cfg.enable_index_links = atoi(value); |
138 | else if (!strcmp(name, "enable-log-filecount")) | 138 | else if (!strcmp(name, "enable-log-filecount")) |
139 | ctx.cfg.enable_log_filecount = atoi(value); | 139 | ctx.cfg.enable_log_filecount = atoi(value); |
140 | else if (!strcmp(name, "enable-log-linecount")) | 140 | else if (!strcmp(name, "enable-log-linecount")) |
141 | ctx.cfg.enable_log_linecount = atoi(value); | 141 | ctx.cfg.enable_log_linecount = atoi(value); |
142 | else if (!strcmp(name, "enable-remote-branches")) | 142 | else if (!strcmp(name, "enable-remote-branches")) |
143 | ctx.cfg.enable_remote_branches = atoi(value); | 143 | ctx.cfg.enable_remote_branches = atoi(value); |
144 | else if (!strcmp(name, "enable-tree-linenumbers")) | 144 | else if (!strcmp(name, "enable-tree-linenumbers")) |
145 | ctx.cfg.enable_tree_linenumbers = atoi(value); | 145 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
146 | else if (!strcmp(name, "max-stats")) | 146 | else if (!strcmp(name, "max-stats")) |
147 | ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); | 147 | ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); |
148 | else if (!strcmp(name, "cache-size")) | 148 | else if (!strcmp(name, "cache-size")) |
149 | ctx.cfg.cache_size = atoi(value); | 149 | ctx.cfg.cache_size = atoi(value); |
150 | else if (!strcmp(name, "cache-root")) | 150 | else if (!strcmp(name, "cache-root")) |
151 | ctx.cfg.cache_root = xstrdup(value); | 151 | ctx.cfg.cache_root = xstrdup(value); |
152 | else if (!strcmp(name, "cache-root-ttl")) | 152 | else if (!strcmp(name, "cache-root-ttl")) |
153 | ctx.cfg.cache_root_ttl = atoi(value); | 153 | ctx.cfg.cache_root_ttl = atoi(value); |
154 | else if (!strcmp(name, "cache-repo-ttl")) | 154 | else if (!strcmp(name, "cache-repo-ttl")) |
155 | ctx.cfg.cache_repo_ttl = atoi(value); | 155 | ctx.cfg.cache_repo_ttl = atoi(value); |
156 | else if (!strcmp(name, "cache-scanrc-ttl")) | 156 | else if (!strcmp(name, "cache-scanrc-ttl")) |
157 | ctx.cfg.cache_scanrc_ttl = atoi(value); | 157 | ctx.cfg.cache_scanrc_ttl = atoi(value); |
158 | else if (!strcmp(name, "cache-static-ttl")) | 158 | else if (!strcmp(name, "cache-static-ttl")) |
159 | ctx.cfg.cache_static_ttl = atoi(value); | 159 | ctx.cfg.cache_static_ttl = atoi(value); |
160 | else if (!strcmp(name, "cache-dynamic-ttl")) | 160 | else if (!strcmp(name, "cache-dynamic-ttl")) |
161 | ctx.cfg.cache_dynamic_ttl = atoi(value); | 161 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
162 | else if (!strcmp(name, "about-filter")) | 162 | else if (!strcmp(name, "about-filter")) |
163 | ctx.cfg.about_filter = new_filter(value, 0); | 163 | ctx.cfg.about_filter = new_filter(value, 0); |
164 | else if (!strcmp(name, "commit-filter")) | 164 | else if (!strcmp(name, "commit-filter")) |
165 | ctx.cfg.commit_filter = new_filter(value, 0); | 165 | ctx.cfg.commit_filter = new_filter(value, 0); |
166 | else if (!strcmp(name, "embedded")) | 166 | else if (!strcmp(name, "embedded")) |
167 | ctx.cfg.embedded = atoi(value); | 167 | ctx.cfg.embedded = atoi(value); |
168 | else if (!strcmp(name, "max-atom-items")) | ||
169 | ctx.cfg.max_atom_items = atoi(value); | ||
168 | else if (!strcmp(name, "max-message-length")) | 170 | else if (!strcmp(name, "max-message-length")) |
169 | ctx.cfg.max_msg_len = atoi(value); | 171 | ctx.cfg.max_msg_len = atoi(value); |
170 | else if (!strcmp(name, "max-repodesc-length")) | 172 | else if (!strcmp(name, "max-repodesc-length")) |
171 | ctx.cfg.max_repodesc_len = atoi(value); | 173 | ctx.cfg.max_repodesc_len = atoi(value); |
172 | else if (!strcmp(name, "max-blob-size")) | 174 | else if (!strcmp(name, "max-blob-size")) |
173 | ctx.cfg.max_blob_size = atoi(value); | 175 | ctx.cfg.max_blob_size = atoi(value); |
174 | else if (!strcmp(name, "max-repo-count")) | 176 | else if (!strcmp(name, "max-repo-count")) |
175 | ctx.cfg.max_repo_count = atoi(value); | 177 | ctx.cfg.max_repo_count = atoi(value); |
176 | else if (!strcmp(name, "max-commit-count")) | 178 | else if (!strcmp(name, "max-commit-count")) |
177 | ctx.cfg.max_commit_count = atoi(value); | 179 | ctx.cfg.max_commit_count = atoi(value); |
178 | else if (!strcmp(name, "scan-path")) | 180 | else if (!strcmp(name, "scan-path")) |
179 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) | 181 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
180 | process_cached_repolist(value); | 182 | process_cached_repolist(value); |
181 | else | 183 | else |
182 | scan_tree(value, repo_config); | 184 | scan_tree(value, repo_config); |
183 | else if (!strcmp(name, "source-filter")) | 185 | else if (!strcmp(name, "source-filter")) |
184 | ctx.cfg.source_filter = new_filter(value, 1); | 186 | ctx.cfg.source_filter = new_filter(value, 1); |
185 | else if (!strcmp(name, "summary-log")) | 187 | else if (!strcmp(name, "summary-log")) |
186 | ctx.cfg.summary_log = atoi(value); | 188 | ctx.cfg.summary_log = atoi(value); |
187 | else if (!strcmp(name, "summary-branches")) | 189 | else if (!strcmp(name, "summary-branches")) |
188 | ctx.cfg.summary_branches = atoi(value); | 190 | ctx.cfg.summary_branches = atoi(value); |
189 | else if (!strcmp(name, "summary-tags")) | 191 | else if (!strcmp(name, "summary-tags")) |
190 | ctx.cfg.summary_tags = atoi(value); | 192 | ctx.cfg.summary_tags = atoi(value); |
191 | else if (!strcmp(name, "side-by-side-diffs")) | 193 | else if (!strcmp(name, "side-by-side-diffs")) |
192 | ctx.cfg.ssdiff = atoi(value); | 194 | ctx.cfg.ssdiff = atoi(value); |
193 | else if (!strcmp(name, "agefile")) | 195 | else if (!strcmp(name, "agefile")) |
194 | ctx.cfg.agefile = xstrdup(value); | 196 | ctx.cfg.agefile = xstrdup(value); |
195 | else if (!strcmp(name, "renamelimit")) | 197 | else if (!strcmp(name, "renamelimit")) |
196 | ctx.cfg.renamelimit = atoi(value); | 198 | ctx.cfg.renamelimit = atoi(value); |
197 | else if (!strcmp(name, "robots")) | 199 | else if (!strcmp(name, "robots")) |
198 | ctx.cfg.robots = xstrdup(value); | 200 | ctx.cfg.robots = xstrdup(value); |
199 | else if (!strcmp(name, "clone-prefix")) | 201 | else if (!strcmp(name, "clone-prefix")) |
200 | ctx.cfg.clone_prefix = xstrdup(value); | 202 | ctx.cfg.clone_prefix = xstrdup(value); |
201 | else if (!strcmp(name, "local-time")) | 203 | else if (!strcmp(name, "local-time")) |
202 | ctx.cfg.local_time = atoi(value); | 204 | ctx.cfg.local_time = atoi(value); |
203 | else if (!prefixcmp(name, "mimetype.")) | 205 | else if (!prefixcmp(name, "mimetype.")) |
204 | add_mimetype(name + 9, value); | 206 | add_mimetype(name + 9, value); |
205 | else if (!strcmp(name, "include")) | 207 | else if (!strcmp(name, "include")) |
206 | parse_configfile(value, config_cb); | 208 | parse_configfile(value, config_cb); |
207 | } | 209 | } |
208 | 210 | ||
209 | static void querystring_cb(const char *name, const char *value) | 211 | static void querystring_cb(const char *name, const char *value) |
210 | { | 212 | { |
211 | if (!value) | 213 | if (!value) |
212 | value = ""; | 214 | value = ""; |
213 | 215 | ||
214 | if (!strcmp(name,"r")) { | 216 | if (!strcmp(name,"r")) { |
215 | ctx.qry.repo = xstrdup(value); | 217 | ctx.qry.repo = xstrdup(value); |
@@ -249,96 +251,97 @@ static void querystring_cb(const char *name, const char *value) | |||
249 | } else if (!strcmp(name, "period")) { | 251 | } else if (!strcmp(name, "period")) { |
250 | ctx.qry.period = xstrdup(value); | 252 | ctx.qry.period = xstrdup(value); |
251 | } else if (!strcmp(name, "ss")) { | 253 | } else if (!strcmp(name, "ss")) { |
252 | ctx.qry.ssdiff = atoi(value); | 254 | ctx.qry.ssdiff = atoi(value); |
253 | } else if (!strcmp(name, "all")) { | 255 | } else if (!strcmp(name, "all")) { |
254 | ctx.qry.show_all = atoi(value); | 256 | ctx.qry.show_all = atoi(value); |
255 | } | 257 | } |
256 | } | 258 | } |
257 | 259 | ||
258 | char *xstrdupn(const char *str) | 260 | char *xstrdupn(const char *str) |
259 | { | 261 | { |
260 | return (str ? xstrdup(str) : NULL); | 262 | return (str ? xstrdup(str) : NULL); |
261 | } | 263 | } |
262 | 264 | ||
263 | static void prepare_context(struct cgit_context *ctx) | 265 | static void prepare_context(struct cgit_context *ctx) |
264 | { | 266 | { |
265 | memset(ctx, 0, sizeof(*ctx)); | 267 | memset(ctx, 0, sizeof(*ctx)); |
266 | ctx->cfg.agefile = "info/web/last-modified"; | 268 | ctx->cfg.agefile = "info/web/last-modified"; |
267 | ctx->cfg.nocache = 0; | 269 | ctx->cfg.nocache = 0; |
268 | ctx->cfg.cache_size = 0; | 270 | ctx->cfg.cache_size = 0; |
269 | ctx->cfg.cache_dynamic_ttl = 5; | 271 | ctx->cfg.cache_dynamic_ttl = 5; |
270 | ctx->cfg.cache_max_create_time = 5; | 272 | ctx->cfg.cache_max_create_time = 5; |
271 | ctx->cfg.cache_repo_ttl = 5; | 273 | ctx->cfg.cache_repo_ttl = 5; |
272 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; | 274 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
273 | ctx->cfg.cache_root_ttl = 5; | 275 | ctx->cfg.cache_root_ttl = 5; |
274 | ctx->cfg.cache_scanrc_ttl = 15; | 276 | ctx->cfg.cache_scanrc_ttl = 15; |
275 | ctx->cfg.cache_static_ttl = -1; | 277 | ctx->cfg.cache_static_ttl = -1; |
276 | ctx->cfg.css = "/cgit.css"; | 278 | ctx->cfg.css = "/cgit.css"; |
277 | ctx->cfg.logo = "/cgit.png"; | 279 | ctx->cfg.logo = "/cgit.png"; |
278 | ctx->cfg.local_time = 0; | 280 | ctx->cfg.local_time = 0; |
279 | ctx->cfg.enable_tree_linenumbers = 1; | 281 | ctx->cfg.enable_tree_linenumbers = 1; |
280 | ctx->cfg.max_repo_count = 50; | 282 | ctx->cfg.max_repo_count = 50; |
281 | ctx->cfg.max_commit_count = 50; | 283 | ctx->cfg.max_commit_count = 50; |
282 | ctx->cfg.max_lock_attempts = 5; | 284 | ctx->cfg.max_lock_attempts = 5; |
283 | ctx->cfg.max_msg_len = 80; | 285 | ctx->cfg.max_msg_len = 80; |
284 | ctx->cfg.max_repodesc_len = 80; | 286 | ctx->cfg.max_repodesc_len = 80; |
285 | ctx->cfg.max_blob_size = 0; | 287 | ctx->cfg.max_blob_size = 0; |
286 | ctx->cfg.max_stats = 0; | 288 | ctx->cfg.max_stats = 0; |
287 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 289 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
288 | ctx->cfg.renamelimit = -1; | 290 | ctx->cfg.renamelimit = -1; |
289 | ctx->cfg.robots = "index, nofollow"; | 291 | ctx->cfg.robots = "index, nofollow"; |
290 | ctx->cfg.root_title = "Git repository browser"; | 292 | ctx->cfg.root_title = "Git repository browser"; |
291 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; | 293 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
292 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; | 294 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
293 | ctx->cfg.section = ""; | 295 | ctx->cfg.section = ""; |
294 | ctx->cfg.summary_branches = 10; | 296 | ctx->cfg.summary_branches = 10; |
295 | ctx->cfg.summary_log = 10; | 297 | ctx->cfg.summary_log = 10; |
296 | ctx->cfg.summary_tags = 10; | 298 | ctx->cfg.summary_tags = 10; |
299 | ctx->cfg.max_atom_items = 10; | ||
297 | ctx->cfg.ssdiff = 0; | 300 | ctx->cfg.ssdiff = 0; |
298 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 301 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
299 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 302 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
300 | ctx->env.https = xstrdupn(getenv("HTTPS")); | 303 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
301 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); | 304 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
302 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); | 305 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
303 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); | 306 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); |
304 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); | 307 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); |
305 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); | 308 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); |
306 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); | 309 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); |
307 | ctx->env.server_port = xstrdupn(getenv("SERVER_PORT")); | 310 | ctx->env.server_port = xstrdupn(getenv("SERVER_PORT")); |
308 | ctx->page.mimetype = "text/html"; | 311 | ctx->page.mimetype = "text/html"; |
309 | ctx->page.charset = PAGE_ENCODING; | 312 | ctx->page.charset = PAGE_ENCODING; |
310 | ctx->page.filename = NULL; | 313 | ctx->page.filename = NULL; |
311 | ctx->page.size = 0; | 314 | ctx->page.size = 0; |
312 | ctx->page.modified = time(NULL); | 315 | ctx->page.modified = time(NULL); |
313 | ctx->page.expires = ctx->page.modified; | 316 | ctx->page.expires = ctx->page.modified; |
314 | ctx->page.etag = NULL; | 317 | ctx->page.etag = NULL; |
315 | memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list)); | 318 | memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list)); |
316 | if (ctx->env.script_name) | 319 | if (ctx->env.script_name) |
317 | ctx->cfg.script_name = ctx->env.script_name; | 320 | ctx->cfg.script_name = ctx->env.script_name; |
318 | if (ctx->env.query_string) | 321 | if (ctx->env.query_string) |
319 | ctx->qry.raw = ctx->env.query_string; | 322 | ctx->qry.raw = ctx->env.query_string; |
320 | if (!ctx->env.cgit_config) | 323 | if (!ctx->env.cgit_config) |
321 | ctx->env.cgit_config = CGIT_CONFIG; | 324 | ctx->env.cgit_config = CGIT_CONFIG; |
322 | } | 325 | } |
323 | 326 | ||
324 | struct refmatch { | 327 | struct refmatch { |
325 | char *req_ref; | 328 | char *req_ref; |
326 | char *first_ref; | 329 | char *first_ref; |
327 | int match; | 330 | int match; |
328 | }; | 331 | }; |
329 | 332 | ||
330 | int find_current_ref(const char *refname, const unsigned char *sha1, | 333 | int find_current_ref(const char *refname, const unsigned char *sha1, |
331 | int flags, void *cb_data) | 334 | int flags, void *cb_data) |
332 | { | 335 | { |
333 | struct refmatch *info; | 336 | struct refmatch *info; |
334 | 337 | ||
335 | info = (struct refmatch *)cb_data; | 338 | info = (struct refmatch *)cb_data; |
336 | if (!strcmp(refname, info->req_ref)) | 339 | if (!strcmp(refname, info->req_ref)) |
337 | info->match = 1; | 340 | info->match = 1; |
338 | if (!info->first_ref) | 341 | if (!info->first_ref) |
339 | info->first_ref = xstrdup(refname); | 342 | info->first_ref = xstrdup(refname); |
340 | return info->match; | 343 | return info->match; |
341 | } | 344 | } |
342 | 345 | ||
343 | char *find_default_branch(struct cgit_repo *repo) | 346 | char *find_default_branch(struct cgit_repo *repo) |
344 | { | 347 | { |
@@ -139,96 +139,97 @@ struct cgit_query { | |||
139 | char *name; | 139 | char *name; |
140 | char *mimetype; | 140 | char *mimetype; |
141 | char *url; | 141 | char *url; |
142 | char *period; | 142 | char *period; |
143 | int ofs; | 143 | int ofs; |
144 | int nohead; | 144 | int nohead; |
145 | char *sort; | 145 | char *sort; |
146 | int showmsg; | 146 | int showmsg; |
147 | int ssdiff; | 147 | int ssdiff; |
148 | int show_all; | 148 | int show_all; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | struct cgit_config { | 151 | struct cgit_config { |
152 | char *agefile; | 152 | char *agefile; |
153 | char *cache_root; | 153 | char *cache_root; |
154 | char *clone_prefix; | 154 | char *clone_prefix; |
155 | char *css; | 155 | char *css; |
156 | char *favicon; | 156 | char *favicon; |
157 | char *footer; | 157 | char *footer; |
158 | char *head_include; | 158 | char *head_include; |
159 | char *header; | 159 | char *header; |
160 | char *index_header; | 160 | char *index_header; |
161 | char *index_info; | 161 | char *index_info; |
162 | char *logo; | 162 | char *logo; |
163 | char *logo_link; | 163 | char *logo_link; |
164 | char *module_link; | 164 | char *module_link; |
165 | char *robots; | 165 | char *robots; |
166 | char *root_title; | 166 | char *root_title; |
167 | char *root_desc; | 167 | char *root_desc; |
168 | char *root_readme; | 168 | char *root_readme; |
169 | char *script_name; | 169 | char *script_name; |
170 | char *section; | 170 | char *section; |
171 | char *virtual_root; | 171 | char *virtual_root; |
172 | int cache_size; | 172 | int cache_size; |
173 | int cache_dynamic_ttl; | 173 | int cache_dynamic_ttl; |
174 | int cache_max_create_time; | 174 | int cache_max_create_time; |
175 | int cache_repo_ttl; | 175 | int cache_repo_ttl; |
176 | int cache_root_ttl; | 176 | int cache_root_ttl; |
177 | int cache_scanrc_ttl; | 177 | int cache_scanrc_ttl; |
178 | int cache_static_ttl; | 178 | int cache_static_ttl; |
179 | int embedded; | 179 | int embedded; |
180 | int enable_filter_overrides; | 180 | int enable_filter_overrides; |
181 | int enable_index_links; | 181 | int enable_index_links; |
182 | int enable_log_filecount; | 182 | int enable_log_filecount; |
183 | int enable_log_linecount; | 183 | int enable_log_linecount; |
184 | int enable_remote_branches; | 184 | int enable_remote_branches; |
185 | int enable_tree_linenumbers; | 185 | int enable_tree_linenumbers; |
186 | int local_time; | 186 | int local_time; |
187 | int max_atom_items; | ||
187 | int max_repo_count; | 188 | int max_repo_count; |
188 | int max_commit_count; | 189 | int max_commit_count; |
189 | int max_lock_attempts; | 190 | int max_lock_attempts; |
190 | int max_msg_len; | 191 | int max_msg_len; |
191 | int max_repodesc_len; | 192 | int max_repodesc_len; |
192 | int max_blob_size; | 193 | int max_blob_size; |
193 | int max_stats; | 194 | int max_stats; |
194 | int nocache; | 195 | int nocache; |
195 | int noplainemail; | 196 | int noplainemail; |
196 | int noheader; | 197 | int noheader; |
197 | int renamelimit; | 198 | int renamelimit; |
198 | int snapshots; | 199 | int snapshots; |
199 | int summary_branches; | 200 | int summary_branches; |
200 | int summary_log; | 201 | int summary_log; |
201 | int summary_tags; | 202 | int summary_tags; |
202 | int ssdiff; | 203 | int ssdiff; |
203 | struct string_list mimetypes; | 204 | struct string_list mimetypes; |
204 | struct cgit_filter *about_filter; | 205 | struct cgit_filter *about_filter; |
205 | struct cgit_filter *commit_filter; | 206 | struct cgit_filter *commit_filter; |
206 | struct cgit_filter *source_filter; | 207 | struct cgit_filter *source_filter; |
207 | }; | 208 | }; |
208 | 209 | ||
209 | struct cgit_page { | 210 | struct cgit_page { |
210 | time_t modified; | 211 | time_t modified; |
211 | time_t expires; | 212 | time_t expires; |
212 | size_t size; | 213 | size_t size; |
213 | char *mimetype; | 214 | char *mimetype; |
214 | char *charset; | 215 | char *charset; |
215 | char *filename; | 216 | char *filename; |
216 | char *etag; | 217 | char *etag; |
217 | char *title; | 218 | char *title; |
218 | int status; | 219 | int status; |
219 | char *statusmsg; | 220 | char *statusmsg; |
220 | }; | 221 | }; |
221 | 222 | ||
222 | struct cgit_environment { | 223 | struct cgit_environment { |
223 | char *cgit_config; | 224 | char *cgit_config; |
224 | char *http_host; | 225 | char *http_host; |
225 | char *https; | 226 | char *https; |
226 | char *no_http; | 227 | char *no_http; |
227 | char *path_info; | 228 | char *path_info; |
228 | char *query_string; | 229 | char *query_string; |
229 | char *request_method; | 230 | char *request_method; |
230 | char *script_name; | 231 | char *script_name; |
231 | char *server_name; | 232 | char *server_name; |
232 | char *server_port; | 233 | char *server_port; |
233 | }; | 234 | }; |
234 | 235 | ||
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index d74d9e7..6cdfd03 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -121,96 +121,100 @@ enable-tree-linenumbers:: | |||
121 | 121 | ||
122 | favicon:: | 122 | favicon:: |
123 | Url used as link to a shortcut icon for cgit. If specified, it is | 123 | Url used as link to a shortcut icon for cgit. If specified, it is |
124 | suggested to use the value "/favicon.ico" since certain browsers will | 124 | suggested to use the value "/favicon.ico" since certain browsers will |
125 | ignore other values. Default value: none. | 125 | ignore other values. Default value: none. |
126 | 126 | ||
127 | footer:: | 127 | footer:: |
128 | The content of the file specified with this option will be included | 128 | The content of the file specified with this option will be included |
129 | verbatim at the bottom of all pages (i.e. it replaces the standard | 129 | verbatim at the bottom of all pages (i.e. it replaces the standard |
130 | "generated by..." message. Default value: none. | 130 | "generated by..." message. Default value: none. |
131 | 131 | ||
132 | head-include:: | 132 | head-include:: |
133 | The content of the file specified with this option will be included | 133 | The content of the file specified with this option will be included |
134 | verbatim in the html HEAD section on all pages. Default value: none. | 134 | verbatim in the html HEAD section on all pages. Default value: none. |
135 | 135 | ||
136 | header:: | 136 | header:: |
137 | The content of the file specified with this option will be included | 137 | The content of the file specified with this option will be included |
138 | verbatim at the top of all pages. Default value: none. | 138 | verbatim at the top of all pages. Default value: none. |
139 | 139 | ||
140 | include:: | 140 | include:: |
141 | Name of a configfile to include before the rest of the current config- | 141 | Name of a configfile to include before the rest of the current config- |
142 | file is parsed. Default value: none. | 142 | file is parsed. Default value: none. |
143 | 143 | ||
144 | index-header:: | 144 | index-header:: |
145 | The content of the file specified with this option will be included | 145 | The content of the file specified with this option will be included |
146 | verbatim above the repository index. This setting is deprecated, and | 146 | verbatim above the repository index. This setting is deprecated, and |
147 | will not be supported by cgit-1.0 (use root-readme instead). Default | 147 | will not be supported by cgit-1.0 (use root-readme instead). Default |
148 | value: none. | 148 | value: none. |
149 | 149 | ||
150 | index-info:: | 150 | index-info:: |
151 | The content of the file specified with this option will be included | 151 | The content of the file specified with this option will be included |
152 | verbatim below the heading on the repository index page. This setting | 152 | verbatim below the heading on the repository index page. This setting |
153 | is deprecated, and will not be supported by cgit-1.0 (use root-desc | 153 | is deprecated, and will not be supported by cgit-1.0 (use root-desc |
154 | instead). Default value: none. | 154 | instead). Default value: none. |
155 | 155 | ||
156 | local-time:: | 156 | local-time:: |
157 | Flag which, if set to "1", makes cgit print commit and tag times in the | 157 | Flag which, if set to "1", makes cgit print commit and tag times in the |
158 | servers timezone. Default value: "0". | 158 | servers timezone. Default value: "0". |
159 | 159 | ||
160 | logo:: | 160 | logo:: |
161 | Url which specifies the source of an image which will be used as a logo | 161 | Url which specifies the source of an image which will be used as a logo |
162 | on all cgit pages. Default value: "/cgit.png". | 162 | on all cgit pages. Default value: "/cgit.png". |
163 | 163 | ||
164 | logo-link:: | 164 | logo-link:: |
165 | Url loaded when clicking on the cgit logo image. If unspecified the | 165 | Url loaded when clicking on the cgit logo image. If unspecified the |
166 | calculated url of the repository index page will be used. Default | 166 | calculated url of the repository index page will be used. Default |
167 | value: none. | 167 | value: none. |
168 | 168 | ||
169 | max-atom-items:: | ||
170 | Specifies the number of items to display in atom feeds view. Default | ||
171 | value: "10". | ||
172 | |||
169 | max-commit-count:: | 173 | max-commit-count:: |
170 | Specifies the number of entries to list per page in "log" view. Default | 174 | Specifies the number of entries to list per page in "log" view. Default |
171 | value: "50". | 175 | value: "50". |
172 | 176 | ||
173 | max-message-length:: | 177 | max-message-length:: |
174 | Specifies the maximum number of commit message characters to display in | 178 | Specifies the maximum number of commit message characters to display in |
175 | "log" view. Default value: "80". | 179 | "log" view. Default value: "80". |
176 | 180 | ||
177 | max-repo-count:: | 181 | max-repo-count:: |
178 | Specifies the number of entries to list per page on therepository | 182 | Specifies the number of entries to list per page on therepository |
179 | index page. Default value: "50". | 183 | index page. Default value: "50". |
180 | 184 | ||
181 | max-repodesc-length:: | 185 | max-repodesc-length:: |
182 | Specifies the maximum number of repo description characters to display | 186 | Specifies the maximum number of repo description characters to display |
183 | on the repository index page. Default value: "80". | 187 | on the repository index page. Default value: "80". |
184 | 188 | ||
185 | max-blob-size:: | 189 | max-blob-size:: |
186 | Specifies the maximum size of a blob to display HTML for in KBytes. | 190 | Specifies the maximum size of a blob to display HTML for in KBytes. |
187 | Default value: "0" (limit disabled). | 191 | Default value: "0" (limit disabled). |
188 | 192 | ||
189 | max-stats:: | 193 | max-stats:: |
190 | Set the default maximum statistics period. Valid values are "week", | 194 | Set the default maximum statistics period. Valid values are "week", |
191 | "month", "quarter" and "year". If unspecified, statistics are | 195 | "month", "quarter" and "year". If unspecified, statistics are |
192 | disabled. Default value: none. See also: "repo.max-stats". | 196 | disabled. Default value: none. See also: "repo.max-stats". |
193 | 197 | ||
194 | mimetype.<ext>:: | 198 | mimetype.<ext>:: |
195 | Set the mimetype for the specified filename extension. This is used | 199 | Set the mimetype for the specified filename extension. This is used |
196 | by the `plain` command when returning blob content. | 200 | by the `plain` command when returning blob content. |
197 | 201 | ||
198 | module-link:: | 202 | module-link:: |
199 | Text which will be used as the formatstring for a hyperlink when a | 203 | Text which will be used as the formatstring for a hyperlink when a |
200 | submodule is printed in a directory listing. The arguments for the | 204 | submodule is printed in a directory listing. The arguments for the |
201 | formatstring are the path and SHA1 of the submodule commit. Default | 205 | formatstring are the path and SHA1 of the submodule commit. Default |
202 | value: "./?repo=%s&page=commit&id=%s" | 206 | value: "./?repo=%s&page=commit&id=%s" |
203 | 207 | ||
204 | nocache:: | 208 | nocache:: |
205 | If set to the value "1" caching will be disabled. This settings is | 209 | If set to the value "1" caching will be disabled. This settings is |
206 | deprecated, and will not be honored starting with cgit-1.0. Default | 210 | deprecated, and will not be honored starting with cgit-1.0. Default |
207 | value: "0". | 211 | value: "0". |
208 | 212 | ||
209 | noplainemail:: | 213 | noplainemail:: |
210 | If set to "1" showing full author email adresses will be disabled. | 214 | If set to "1" showing full author email adresses will be disabled. |
211 | Default value: "0". | 215 | Default value: "0". |
212 | 216 | ||
213 | noheader:: | 217 | noheader:: |
214 | Flag which, when set to "1", will make cgit omit the standard header | 218 | Flag which, when set to "1", will make cgit omit the standard header |
215 | on all pages. Default value: none. See also: "embedded". | 219 | on all pages. Default value: none. See also: "embedded". |
216 | 220 | ||
@@ -1,84 +1,84 @@ | |||
1 | /* cmd.c: the cgit command dispatcher | 1 | /* cmd.c: the cgit command dispatcher |
2 | * | 2 | * |
3 | * Copyright (C) 2008 Lars Hjemli | 3 | * Copyright (C) 2008 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | #include "cmd.h" | 10 | #include "cmd.h" |
11 | #include "cache.h" | 11 | #include "cache.h" |
12 | #include "ui-shared.h" | 12 | #include "ui-shared.h" |
13 | #include "ui-atom.h" | 13 | #include "ui-atom.h" |
14 | #include "ui-blob.h" | 14 | #include "ui-blob.h" |
15 | #include "ui-clone.h" | 15 | #include "ui-clone.h" |
16 | #include "ui-commit.h" | 16 | #include "ui-commit.h" |
17 | #include "ui-diff.h" | 17 | #include "ui-diff.h" |
18 | #include "ui-log.h" | 18 | #include "ui-log.h" |
19 | #include "ui-patch.h" | 19 | #include "ui-patch.h" |
20 | #include "ui-plain.h" | 20 | #include "ui-plain.h" |
21 | #include "ui-refs.h" | 21 | #include "ui-refs.h" |
22 | #include "ui-repolist.h" | 22 | #include "ui-repolist.h" |
23 | #include "ui-snapshot.h" | 23 | #include "ui-snapshot.h" |
24 | #include "ui-stats.h" | 24 | #include "ui-stats.h" |
25 | #include "ui-summary.h" | 25 | #include "ui-summary.h" |
26 | #include "ui-tag.h" | 26 | #include "ui-tag.h" |
27 | #include "ui-tree.h" | 27 | #include "ui-tree.h" |
28 | 28 | ||
29 | static void HEAD_fn(struct cgit_context *ctx) | 29 | static void HEAD_fn(struct cgit_context *ctx) |
30 | { | 30 | { |
31 | cgit_clone_head(ctx); | 31 | cgit_clone_head(ctx); |
32 | } | 32 | } |
33 | 33 | ||
34 | static void atom_fn(struct cgit_context *ctx) | 34 | static void atom_fn(struct cgit_context *ctx) |
35 | { | 35 | { |
36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, 10); | 36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, ctx->cfg.max_atom_items); |
37 | } | 37 | } |
38 | 38 | ||
39 | static void about_fn(struct cgit_context *ctx) | 39 | static void about_fn(struct cgit_context *ctx) |
40 | { | 40 | { |
41 | if (ctx->repo) | 41 | if (ctx->repo) |
42 | cgit_print_repo_readme(ctx->qry.path); | 42 | cgit_print_repo_readme(ctx->qry.path); |
43 | else | 43 | else |
44 | cgit_print_site_readme(); | 44 | cgit_print_site_readme(); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void blob_fn(struct cgit_context *ctx) | 47 | static void blob_fn(struct cgit_context *ctx) |
48 | { | 48 | { |
49 | cgit_print_blob(ctx->qry.sha1, ctx->qry.path, ctx->qry.head); | 49 | cgit_print_blob(ctx->qry.sha1, ctx->qry.path, ctx->qry.head); |
50 | } | 50 | } |
51 | 51 | ||
52 | static void commit_fn(struct cgit_context *ctx) | 52 | static void commit_fn(struct cgit_context *ctx) |
53 | { | 53 | { |
54 | cgit_print_commit(ctx->qry.sha1); | 54 | cgit_print_commit(ctx->qry.sha1); |
55 | } | 55 | } |
56 | 56 | ||
57 | static void diff_fn(struct cgit_context *ctx) | 57 | static void diff_fn(struct cgit_context *ctx) |
58 | { | 58 | { |
59 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path); | 59 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path); |
60 | } | 60 | } |
61 | 61 | ||
62 | static void info_fn(struct cgit_context *ctx) | 62 | static void info_fn(struct cgit_context *ctx) |
63 | { | 63 | { |
64 | cgit_clone_info(ctx); | 64 | cgit_clone_info(ctx); |
65 | } | 65 | } |
66 | 66 | ||
67 | static void log_fn(struct cgit_context *ctx) | 67 | static void log_fn(struct cgit_context *ctx) |
68 | { | 68 | { |
69 | cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count, | 69 | cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count, |
70 | ctx->qry.grep, ctx->qry.search, ctx->qry.path, 1); | 70 | ctx->qry.grep, ctx->qry.search, ctx->qry.path, 1); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void ls_cache_fn(struct cgit_context *ctx) | 73 | static void ls_cache_fn(struct cgit_context *ctx) |
74 | { | 74 | { |
75 | ctx->page.mimetype = "text/plain"; | 75 | ctx->page.mimetype = "text/plain"; |
76 | ctx->page.filename = "ls-cache.txt"; | 76 | ctx->page.filename = "ls-cache.txt"; |
77 | cgit_print_http_headers(ctx); | 77 | cgit_print_http_headers(ctx); |
78 | cache_ls(ctx->cfg.cache_root); | 78 | cache_ls(ctx->cfg.cache_root); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void objects_fn(struct cgit_context *ctx) | 81 | static void objects_fn(struct cgit_context *ctx) |
82 | { | 82 | { |
83 | cgit_clone_objects(ctx); | 83 | cgit_clone_objects(ctx); |
84 | } | 84 | } |