aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--Makefile21
-rw-r--r--cgit-doc.css3
-rw-r--r--cgit.c87
-rw-r--r--cgit.css2
-rw-r--r--cgit.h41
-rw-r--r--cgitrc.5.txt187
-rw-r--r--cmd.c2
-rwxr-xr-xfilters/commit-links.sh12
-rwxr-xr-xfilters/syntax-highlighting.sh39
m---------git0
-rw-r--r--shared.c38
-rw-r--r--ui-atom.c8
-rw-r--r--ui-blob.c8
-rw-r--r--ui-commit.c20
-rw-r--r--ui-log.c4
-rw-r--r--ui-patch.c6
-rw-r--r--ui-plain.c18
-rw-r--r--ui-refs.c19
-rw-r--r--ui-repolist.c9
-rw-r--r--ui-shared.c81
-rw-r--r--ui-shared.h1
-rw-r--r--ui-snapshot.c35
-rw-r--r--ui-summary.c28
-rw-r--r--ui-summary.h2
-rw-r--r--ui-tag.c2
-rw-r--r--ui-tree.c26
27 files changed, 553 insertions, 151 deletions
<
diff --git a/.gitignore b/.gitignore
index 1e016e5..487728b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,5 +2,10 @@
2cgit 2cgit
3cgit.conf 3cgit.conf
4VERSION 4VERSION
5cgitrc.5
6cgitrc.5.fo
7cgitrc.5.html
8cgitrc.5.pdf
9cgitrc.5.xml
5*.o 10*.o
6*.d 11*.d
diff --git a/Makefile b/Makefile
index 33c606d..1f9893a 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
5CGIT_CONFIG = /etc/cgitrc 5CGIT_CONFIG = /etc/cgitrc
6CACHE_ROOT = /var/cache/cgit 6CACHE_ROOT = /var/cache/cgit
7SHA1_HEADER = <openssl/sha.h> 7SHA1_HEADER = <openssl/sha.h>
8GIT_VER = 1.6.1.1 8GIT_VER = 1.6.3.4
9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
10INSTALL = install 10INSTALL = install
11 11
@@ -100,7 +100,8 @@ ifdef NEEDS_LIBICONV
100endif 100endif
101 101
102 102
103.PHONY: all libgit test install uninstall clean force-version get-git 103.PHONY: all libgit test install uninstall clean force-version get-git \
104 doc man-doc html-doc clean-doc
104 105
105all: cgit 106all: cgit
106 107
@@ -149,8 +150,22 @@ uninstall:
149 rm -f $(CGIT_DATA_PATH)/cgit.css 150 rm -f $(CGIT_DATA_PATH)/cgit.css
150 rm -f $(CGIT_DATA_PATH)/cgit.png 151 rm -f $(CGIT_DATA_PATH)/cgit.png
151 152
152clean: 153doc: man-doc html-doc pdf-doc
154
155man-doc: cgitrc.5.txt
156 a2x -f manpage cgitrc.5.txt
157
158html-doc: cgitrc.5.txt
159 a2x -f xhtml --stylesheet=cgit-doc.css cgitrc.5.txt
160
161pdf-doc: cgitrc.5.txt
162 a2x -f pdf cgitrc.5.txt
163
164clean: clean-doc
153 rm -f cgit VERSION *.o *.d 165 rm -f cgit VERSION *.o *.d
154 166
167clean-doc:
168 rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
169
155get-git: 170get-git:
156 curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git 171 curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git
diff --git a/cgit-doc.css b/cgit-doc.css
new file mode 100644
index 0000000..5a399b6
--- /dev/null
+++ b/cgit-doc.css
@@ -0,0 +1,3 @@
1div.variablelist dt {
2 margin-top: 1em;
3}
diff --git a/cgit.c b/cgit.c
index 5301840..5816f3d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -17,6 +17,29 @@
17 17
18const char *cgit_version = CGIT_VERSION; 18const char *cgit_version = CGIT_VERSION;
19 19
20void add_mimetype(const char *name, const char *value)
21{
22 struct string_list_item *item;
23
24 item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes);
25 item->util = xstrdup(value);
26}
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
20void config_cb(const char *name, const char *value) 43void config_cb(const char *name, const char *value)
21{ 44{
22 if (!strcmp(name, "root-title")) 45 if (!strcmp(name, "root-title"))
@@ -31,6 +54,8 @@ void config_cb(const char *name, const char *value)
31 ctx.cfg.favicon = xstrdup(value); 54 ctx.cfg.favicon = xstrdup(value);
32 else if (!strcmp(name, "footer")) 55 else if (!strcmp(name, "footer"))
33 ctx.cfg.footer = xstrdup(value); 56 ctx.cfg.footer = xstrdup(value);
57 else if (!strcmp(name, "head-include"))
58 ctx.cfg.head_include = xstrdup(value);
34 else if (!strcmp(name, "header")) 59 else if (!strcmp(name, "header"))
35 ctx.cfg.header = xstrdup(value); 60 ctx.cfg.header = xstrdup(value);
36 else if (!strcmp(name, "logo")) 61 else if (!strcmp(name, "logo"))
@@ -49,6 +74,10 @@ void config_cb(const char *name, const char *value)
49 ctx.cfg.virtual_root = ""; 74 ctx.cfg.virtual_root = "";
50 } else if (!strcmp(name, "nocache")) 75 } else if (!strcmp(name, "nocache"))
51 ctx.cfg.nocache = atoi(value); 76 ctx.cfg.nocache = atoi(value);
77 else if (!strcmp(name, "noplainemail"))
78 ctx.cfg.noplainemail = atoi(value);
79 else if (!strcmp(name, "noheader"))
80 ctx.cfg.noheader = atoi(value);
52 else if (!strcmp(name, "snapshots")) 81 else if (!strcmp(name, "snapshots"))
53 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); 82 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
54 else if (!strcmp(name, "enable-index-links")) 83 else if (!strcmp(name, "enable-index-links"))
@@ -71,6 +100,12 @@ void config_cb(const char *name, const char *value)
71 ctx.cfg.cache_static_ttl = atoi(value); 100 ctx.cfg.cache_static_ttl = atoi(value);
72 else if (!strcmp(name, "cache-dynamic-ttl")) 101 else if (!strcmp(name, "cache-dynamic-ttl"))
73 ctx.cfg.cache_dynamic_ttl = atoi(value); 102 ctx.cfg.cache_dynamic_ttl = atoi(value);
103 else if (!strcmp(name, "about-filter"))
104 ctx.cfg.about_filter = new_filter(value, 0);
105 else if (!strcmp(name, "commit-filter"))
106 ctx.cfg.commit_filter = new_filter(value, 0);
107 else if (!strcmp(name, "embedded"))
108 ctx.cfg.embedded = atoi(value);
74 else if (!strcmp(name, "max-message-length")) 109 else if (!strcmp(name, "max-message-length"))
75 ctx.cfg.max_msg_len = atoi(value); 110 ctx.cfg.max_msg_len = atoi(value);
76 else if (!strcmp(name, "max-repodesc-length")) 111 else if (!strcmp(name, "max-repodesc-length"))
@@ -79,6 +114,8 @@ void config_cb(const char *name, const char *value)
79 ctx.cfg.max_repo_count = atoi(value); 114 ctx.cfg.max_repo_count = atoi(value);
80 else if (!strcmp(name, "max-commit-count")) 115 else if (!strcmp(name, "max-commit-count"))
81 ctx.cfg.max_commit_count = atoi(value); 116 ctx.cfg.max_commit_count = atoi(value);
117 else if (!strcmp(name, "source-filter"))
118 ctx.cfg.source_filter = new_filter(value, 1);
82 else if (!strcmp(name, "summary-log")) 119 else if (!strcmp(name, "summary-log"))
83 ctx.cfg.summary_log = atoi(value); 120 ctx.cfg.summary_log = atoi(value);
84 else if (!strcmp(name, "summary-branches")) 121 else if (!strcmp(name, "summary-branches"))
@@ -95,6 +132,8 @@ void config_cb(const char *name, const char *value)
95 ctx.cfg.clone_prefix = xstrdup(value); 132 ctx.cfg.clone_prefix = xstrdup(value);
96 else if (!strcmp(name, "local-time")) 133 else if (!strcmp(name, "local-time"))
97 ctx.cfg.local_time = atoi(value); 134 ctx.cfg.local_time = atoi(value);
135 else if (!prefixcmp(name, "mimetype."))
136 add_mimetype(name + 9, value);
98 else if (!strcmp(name, "repo.group")) 137 else if (!strcmp(name, "repo.group"))
99 ctx.cfg.repo_group = xstrdup(value); 138 ctx.cfg.repo_group = xstrdup(value);
100 else if (!strcmp(name, "repo.url")) 139 else if (!strcmp(name, "repo.url"))
@@ -121,6 +160,12 @@ void config_cb(const char *name, const char *value)
121 ctx.repo->max_stats = cgit_find_stats_period(value, NULL); 160 ctx.repo->max_stats = cgit_find_stats_period(value, NULL);
122 else if (ctx.repo && !strcmp(name, "repo.module-link")) 161 else if (ctx.repo && !strcmp(name, "repo.module-link"))
123 ctx.repo->module_link= xstrdup(value); 162 ctx.repo->module_link= xstrdup(value);
163 else if (ctx.repo && !strcmp(name, "repo.about-filter"))
164 ctx.repo->about_filter = new_filter(value, 0);
165 else if (ctx.repo && !strcmp(name, "repo.commit-filter"))
166 ctx.repo->commit_filter = new_filter(value, 0);
167 else if (ctx.repo && !strcmp(name, "repo.source-filter"))
168 ctx.repo->source_filter = new_filter(value, 1);
124 else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { 169 else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) {
125 if (*value == '/') 170 if (*value == '/')
126 ctx.repo->readme = xstrdup(value); 171 ctx.repo->readme = xstrdup(value);
@@ -173,6 +218,11 @@ static void querystring_cb(const char *name, const char *value)
173 } 218 }
174} 219}
175 220
221char *xstrdupn(const char *str)
222{
223 return (str ? xstrdup(str) : NULL);
224}
225
176static void prepare_context(struct cgit_context *ctx) 226static void prepare_context(struct cgit_context *ctx)
177{ 227{
178 memset(ctx, 0, sizeof(ctx)); 228 memset(ctx, 0, sizeof(ctx));
@@ -186,7 +236,7 @@ static void prepare_context(struct cgit_context *ctx)
186 ctx->cfg.cache_root_ttl = 5; 236 ctx->cfg.cache_root_ttl = 5;
187 ctx->cfg.cache_static_ttl = -1; 237 ctx->cfg.cache_static_ttl = -1;
188 ctx->cfg.css = "/cgit.css"; 238 ctx->cfg.css = "/cgit.css";
189 ctx->cfg.logo = "/git-logo.png"; 239 ctx->cfg.logo = "/cgit.png";
190 ctx->cfg.local_time = 0; 240 ctx->cfg.local_time = 0;
191 ctx->cfg.max_repo_count = 50; 241 ctx->cfg.max_repo_count = 50;
192 ctx->cfg.max_commit_count = 50; 242 ctx->cfg.max_commit_count = 50;
@@ -203,12 +253,30 @@ static void prepare_context(struct cgit_context *ctx)
203 ctx->cfg.summary_branches = 10; 253 ctx->cfg.summary_branches = 10;
204 ctx->cfg.summary_log = 10; 254 ctx->cfg.summary_log = 10;
205 ctx->cfg.summary_tags = 10; 255 ctx->cfg.summary_tags = 10;
256 ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG"));
257 ctx->env.http_host = xstrdupn(getenv("HTTP_HOST"));
258 ctx->env.https = xstrdupn(getenv("HTTPS"));
259 ctx->env.no_http = xstrdupn(getenv("NO_HTTP"));
260 ctx->env.path_info = xstrdupn(getenv("PATH_INFO"));
261 ctx->env.query_string = xstrdupn(getenv("QUERY_STRING"));
262 ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD"));
263 ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME"));
264 ctx->env.server_name = xstrdupn(getenv("SERVER_NAME"));
265 ctx->env.server_port = xstrdupn(getenv("SERVER_PORT"));
206 ctx->page.mimetype = "text/html"; 266 ctx->page.mimetype = "text/html";
207 ctx->page.charset = PAGE_ENCODING; 267 ctx->page.charset = PAGE_ENCODING;
208 ctx->page.filename = NULL; 268 ctx->page.filename = NULL;
209 ctx->page.size = 0; 269 ctx->page.size = 0;
210 ctx->page.modified = time(NULL); 270 ctx->page.modified = time(NULL);
211 ctx->page.expires = ctx->page.modified; 271 ctx->page.expires = ctx->page.modified;
272 ctx->page.etag = NULL;
273 memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
274 if (ctx->env.script_name)
275 ctx->cfg.script_name = ctx->env.script_name;
276 if (ctx->env.query_string)
277 ctx->qry.raw = ctx->env.query_string;
278 if (!ctx->env.cgit_config)
279 ctx->env.cgit_config = CGIT_CONFIG;
212} 280}
213 281
214struct refmatch { 282struct refmatch {
@@ -288,6 +356,8 @@ static int prepare_repo_cmd(struct cgit_context *ctx)
288 if (get_sha1(ctx->qry.head, sha1)) { 356 if (get_sha1(ctx->qry.head, sha1)) {
289 tmp = xstrdup(ctx->qry.head); 357 tmp = xstrdup(ctx->qry.head);
290 ctx->qry.head = ctx->repo->defbranch; 358 ctx->qry.head = ctx->repo->defbranch;
359 ctx->page.status = 404;
360 ctx->page.statusmsg = "not found";
291 cgit_print_http_headers(ctx); 361 cgit_print_http_headers(ctx);
292 cgit_print_docstart(ctx); 362 cgit_print_docstart(ctx);
293 cgit_print_pageheader(ctx); 363 cgit_print_pageheader(ctx);
@@ -379,6 +449,9 @@ static void cgit_parse_args(int argc, const char **argv)
379 if (!strcmp(argv[i], "--nocache")) { 449 if (!strcmp(argv[i], "--nocache")) {
380 ctx.cfg.nocache = 1; 450 ctx.cfg.nocache = 1;
381 } 451 }
452 if (!strcmp(argv[i], "--nohttp")) {
453 ctx.env.no_http = "1";
454 }
382 if (!strncmp(argv[i], "--query=", 8)) { 455 if (!strncmp(argv[i], "--query=", 8)) {
383 ctx.qry.raw = xstrdup(argv[i]+8); 456 ctx.qry.raw = xstrdup(argv[i]+8);
384 } 457 }
@@ -431,7 +504,6 @@ static int calc_ttl()
431 504
432int main(int argc, const char **argv) 505int main(int argc, const char **argv)
433{ 506{
434 const char *cgit_config_env = getenv("CGIT_CONFIG");
435 const char *path; 507 const char *path;
436 char *qry; 508 char *qry;
437 int err, ttl; 509 int err, ttl;
@@ -441,13 +513,8 @@ int main(int argc, const char **argv)
441 cgit_repolist.count = 0; 513 cgit_repolist.count = 0;
442 cgit_repolist.repos = NULL; 514 cgit_repolist.repos = NULL;
443 515
444 if (getenv("SCRIPT_NAME"))
445 ctx.cfg.script_name = xstrdup(getenv("SCRIPT_NAME"));
446 if (getenv("QUERY_STRING"))
447 ctx.qry.raw = xstrdup(getenv("QUERY_STRING"));
448 cgit_parse_args(argc, argv); 516 cgit_parse_args(argc, argv);
449 parse_configfile(cgit_config_env ? cgit_config_env : CGIT_CONFIG, 517 parse_configfile(ctx.env.cgit_config, config_cb);
450 config_cb);
451 ctx.repo = NULL; 518 ctx.repo = NULL;
452 http_parse_querystring(ctx.qry.raw, querystring_cb); 519 http_parse_querystring(ctx.qry.raw, querystring_cb);
453 520
@@ -462,7 +529,7 @@ int main(int argc, const char **argv)
462 * urls without the need for rewriterules in the webserver (as 529 * urls without the need for rewriterules in the webserver (as
463 * long as PATH_INFO is included in the cache lookup key). 530 * long as PATH_INFO is included in the cache lookup key).
464 */ 531 */
465 path = getenv("PATH_INFO"); 532 path = ctx.env.path_info;
466 if (!ctx.qry.url && path) { 533 if (!ctx.qry.url && path) {
467 if (path[0] == '/') 534 if (path[0] == '/')
468 path++; 535 path++;
@@ -478,6 +545,8 @@ int main(int argc, const char **argv)
478 545
479 ttl = calc_ttl(); 546 ttl = calc_ttl();
480 ctx.page.expires += ttl*60; 547 ctx.page.expires += ttl*60;
548 if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
549 ctx.cfg.nocache = 1;
481 if (ctx.cfg.nocache) 550 if (ctx.cfg.nocache)
482 ctx.cfg.cache_size = 0; 551 ctx.cfg.cache_size = 0;
483 err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, 552 err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root,
diff --git a/cgit.css b/cgit.css
index adfc8ae..e3b32e7 100644
--- a/cgit.css
+++ b/cgit.css
@@ -155,7 +155,7 @@ table.list td.logsubject {
155table.list td.logmsg { 155table.list td.logmsg {
156 font-family: monospace; 156 font-family: monospace;
157 white-space: pre; 157 white-space: pre;
158 padding: 1em 0em 2em 0em; 158 padding: 1em 0.5em 2em 0.5em;
159} 159}
160 160
161table.list td a { 161table.list td a {
diff --git a/cgit.h b/cgit.h
index 5f7af51..d90ccdc 100644
--- a/cgit.h
+++ b/cgit.h
@@ -15,6 +15,7 @@
15#include <revision.h> 15#include <revision.h>
16#include <log-tree.h> 16#include <log-tree.h>
17#include <archive.h> 17#include <archive.h>
18#include <string-list.h>
18#include <xdiff-interface.h> 19#include <xdiff-interface.h>
19#include <xdiff/xdiff.h> 20#include <xdiff/xdiff.h>
20#include <utf8.h> 21#include <utf8.h>
@@ -48,6 +49,15 @@ typedef void (*configfn)(const char *name, const char *value);
48typedef void (*filepair_fn)(struct diff_filepair *pair); 49typedef void (*filepair_fn)(struct diff_filepair *pair);
49typedef void (*linediff_fn)(char *line, int len); 50typedef void (*linediff_fn)(char *line, int len);
50 51
52struct cgit_filter {
53 char *cmd;
54 char **argv;
55 int old_stdout;
56 int pipe_fh[2];
57 int pid;
58 int exitstatus;
59};
60
51struct cgit_repo { 61struct cgit_repo {
52 char *url; 62 char *url;
53 char *name; 63 char *name;
@@ -64,6 +74,9 @@ struct cgit_repo {
64 int enable_log_linecount; 74 int enable_log_linecount;
65 int max_stats; 75 int max_stats;
66 time_t mtime; 76 time_t mtime;
77 struct cgit_filter *about_filter;
78 struct cgit_filter *commit_filter;
79 struct cgit_filter *source_filter;
67}; 80};
68 81
69struct cgit_repolist { 82struct cgit_repolist {
@@ -136,6 +149,7 @@ struct cgit_config {
136 char *css; 149 char *css;
137 char *favicon; 150 char *favicon;
138 char *footer; 151 char *footer;
152 char *head_include;
139 char *header; 153 char *header;
140 char *index_header; 154 char *index_header;
141 char *index_info; 155 char *index_info;
@@ -155,6 +169,7 @@ struct cgit_config {
155 int cache_repo_ttl; 169 int cache_repo_ttl;
156 int cache_root_ttl; 170 int cache_root_ttl;
157 int cache_static_ttl; 171 int cache_static_ttl;
172 int embedded;
158 int enable_index_links; 173 int enable_index_links;
159 int enable_log_filecount; 174 int enable_log_filecount;
160 int enable_log_linecount; 175 int enable_log_linecount;
@@ -166,11 +181,17 @@ struct cgit_config {
166 int max_repodesc_len; 181 int max_repodesc_len;
167 int max_stats; 182 int max_stats;
168 int nocache; 183 int nocache;
184 int noplainemail;
185 int noheader;
169 int renamelimit; 186 int renamelimit;
170 int snapshots; 187 int snapshots;
171 int summary_branches; 188 int summary_branches;
172 int summary_log; 189 int summary_log;
173 int summary_tags; 190 int summary_tags;
191 struct string_list mimetypes;
192 struct cgit_filter *about_filter;
193 struct cgit_filter *commit_filter;
194 struct cgit_filter *source_filter;
174}; 195};
175 196
176struct cgit_page { 197struct cgit_page {
@@ -180,10 +201,27 @@ struct cgit_page {
180 char *mimetype; 201 char *mimetype;
181 char *charset; 202 char *charset;
182 char *filename; 203 char *filename;
204 char *etag;
183 char *title; 205 char *title;
206 int status;
207 char *statusmsg;
208};
209
210struct cgit_environment {
211 char *cgit_config;
212 char *http_host;
213 char *https;
214 char *no_http;
215 char *path_info;
216 char *query_string;
217 char *request_method;
218 char *script_name;
219 char *server_name;
220 char *server_port;
184}; 221};
185 222
186struct cgit_context { 223struct cgit_context {
224 struct cgit_environment env;
187 struct cgit_query qry; 225 struct cgit_query qry;
188 struct cgit_config cfg; 226 struct cgit_config cfg;
189 struct cgit_repo *repo; 227 struct cgit_repo *repo;
@@ -242,5 +280,8 @@ extern const char *cgit_repobasename(const char *reponame);
242 280
243extern int cgit_parse_snapshots_mask(const char *str); 281extern int cgit_parse_snapshots_mask(const char *str);
244 282
283extern int cgit_open_filter(struct cgit_filter *filter);
284extern int cgit_close_filter(struct cgit_filter *filter);
285
245 286
246#endif /* CGIT_H */ 287#endif /* CGIT_H */
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index fd299ae..3c35b02 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -1,181 +1,222 @@
1CGITRC 1CGITRC(5)
2====== 2========
3 3
4 4
5NAME 5NAME
6---- 6----
7 cgitrc - runtime configuration for cgit 7cgitrc - runtime configuration for cgit
8 8
9 9
10DESCRIPTION 10SYNOPSIS
11----------- 11--------
12Cgitrc contains all runtime settings for cgit, including the list of git 12Cgitrc contains all runtime settings for cgit, including the list of git
13repositories, formatted as a line-separated list of NAME=VALUE pairs. Blank 13repositories, formatted as a line-separated list of NAME=VALUE pairs. Blank
14lines, and lines starting with '#', are ignored. 14lines, and lines starting with '#', are ignored.
15 15
16 16
17LOCATION
18--------
19The default location of cgitrc, defined at compile time, is /etc/cgitrc. At
20runtime, cgit will consult the environment variable CGIT_CONFIG and, if
21defined, use its value instead.
22
23
17GLOBAL SETTINGS 24GLOBAL SETTINGS
18--------------- 25---------------
19agefile 26about-filter::
27 Specifies a command which will be invoked to format the content of
28 about pages (both top-level and for each repository). The command will
29 get the content of the about-file on its STDIN, and the STDOUT from the
30 command will be included verbatim on the about page. Default value:
31 none.
32
33agefile::
20 Specifies a path, relative to each repository path, which can be used 34 Specifies a path, relative to each repository path, which can be used
21 to specify the date and time of the youngest commit in the repository. 35 to specify the date and time of the youngest commit in the repository.
22 The first line in the file is used as input to the "parse_date" 36 The first line in the file is used as input to the "parse_date"
23 function in libgit. Recommended timestamp-format is "yyyy-mm-dd 37 function in libgit. Recommended timestamp-format is "yyyy-mm-dd
24 hh:mm:ss". Default value: "info/web/last-modified". 38 hh:mm:ss". Default value: "info/web/last-modified".
25 39
26cache-root 40cache-root::
27 Path used to store the cgit cache entries. Default value: 41 Path used to store the cgit cache entries. Default value:
28 "/var/cache/cgit". 42 "/var/cache/cgit".
29 43
30cache-dynamic-ttl 44cache-dynamic-ttl::
31 Number which specifies the time-to-live, in minutes, for the cached 45 Number which specifies the time-to-live, in minutes, for the cached
32 version of repository pages accessed without a fixed SHA1. Default 46 version of repository pages accessed without a fixed SHA1. Default
33 value: "5". 47 value: "5".
34 48
35cache-repo-ttl 49cache-repo-ttl::
36 Number which specifies the time-to-live, in minutes, for the cached 50 Number which specifies the time-to-live, in minutes, for the cached
37 version of the repository summary page. Default value: "5". 51 version of the repository summary page. Default value: "5".
38 52
39cache-root-ttl 53cache-root-ttl::
40 Number which specifies the time-to-live, in minutes, for the cached 54 Number which specifies the time-to-live, in minutes, for the cached
41 version of the repository index page. Default value: "5". 55 version of the repository index page. Default value: "5".
42 56
43cache-size 57cache-size::
44 The maximum number of entries in the cgit cache. Default value: "0" 58 The maximum number of entries in the cgit cache. Default value: "0"
45 (i.e. caching is disabled). 59 (i.e. caching is disabled).
46 60
47cache-static-ttl 61cache-static-ttl::
48 Number which specifies the time-to-live, in minutes, for the cached 62 Number which specifies the time-to-live, in minutes, for the cached
49 version of repository pages accessed with a fixed SHA1. Default value: 63 version of repository pages accessed with a fixed SHA1. Default value:
50 "5". 64 "5".
51 65
52clone-prefix 66clone-prefix::
53 Space-separated list of common prefixes which, when combined with a 67 Space-separated list of common prefixes which, when combined with a
54 repository url, generates valid clone urls for the repository. This 68 repository url, generates valid clone urls for the repository. This
55 setting is only used if `repo.clone-url` is unspecified. Default value: 69 setting is only used if `repo.clone-url` is unspecified. Default value:
56 none. 70 none.
57 71
58css 72commit-filter::
73 Specifies a command which will be invoked to format commit messages.
74 The command will get the message on its STDIN, and the STDOUT from the
75 command will be included verbatim as the commit message, i.e. this can
76 be used to implement bugtracker integration. Default value: none.
77
78css::
59 Url which specifies the css document to include in all cgit pages. 79 Url which specifies the css document to include in all cgit pages.
60 Default value: "/cgit.css". 80 Default value: "/cgit.css".
61 81
62enable-index-links 82embedded::
83 Flag which, when set to "1", will make cgit generate a html fragment
84 suitable for embedding in other html pages. Default value: none. See
85 also: "noheader".
86
87enable-index-links::
63 Flag which, when set to "1", will make cgit generate extra links for 88 Flag which, when set to "1", will make cgit generate extra links for
64 each repo in the repository index (specifically, to the "summary", 89 each repo in the repository index (specifically, to the "summary",
65 "commit" and "tree" pages). Default value: "0". 90 "commit" and "tree" pages). Default value: "0".
66 91
67enable-log-filecount 92enable-log-filecount::
68 Flag which, when set to "1", will make cgit print the number of 93 Flag which, when set to "1", will make cgit print the number of
69 modified files for each commit on the repository log page. Default 94 modified files for each commit on the repository log page. Default
70 value: "0". 95 value: "0".
71 96
72enable-log-linecount 97enable-log-linecount::
73 Flag which, when set to "1", will make cgit print the number of added 98 Flag which, when set to "1", will make cgit print the number of added
74 and removed lines for each commit on the repository log page. Default 99 and removed lines for each commit on the repository log page. Default
75 value: "0". 100 value: "0".
76 101
77favicon 102favicon::
78 Url used as link to a shortcut icon for cgit. If specified, it is 103 Url used as link to a shortcut icon for cgit. If specified, it is
79 suggested to use the value "/favicon.ico" since certain browsers will 104 suggested to use the value "/favicon.ico" since certain browsers will
80 ignore other values. Default value: none. 105 ignore other values. Default value: none.
81 106
82footer 107footer::
83 The content of the file specified with this option will be included 108 The content of the file specified with this option will be included
84 verbatim at the bottom of all pages (i.e. it replaces the standard 109 verbatim at the bottom of all pages (i.e. it replaces the standard
85 "generated by..." message. Default value: none. 110 "generated by..." message. Default value: none.
86 111
87header 112head-include::
113 The content of the file specified with this option will be included
114 verbatim in the html HEAD section on all pages. Default value: none.
115
116header::
88 The content of the file specified with this option will be included 117 The content of the file specified with this option will be included
89 verbatim at the top of all pages. Default value: none. 118 verbatim at the top of all pages. Default value: none.
90 119
91include 120include::
92 Name of a configfile to include before the rest of the current config- 121 Name of a configfile to include before the rest of the current config-
93 file is parsed. Default value: none. 122 file is parsed. Default value: none.
94 123
95index-header 124index-header::
96 The content of the file specified with this option will be included 125 The content of the file specified with this option will be included
97 verbatim above the repository index. This setting is deprecated, and 126 verbatim above the repository index. This setting is deprecated, and
98 will not be supported by cgit-1.0 (use root-readme instead). Default 127 will not be supported by cgit-1.0 (use root-readme instead). Default
99 value: none. 128 value: none.
100 129
101index-info 130index-info::
102 The content of the file specified with this option will be included 131 The content of the file specified with this option will be included
103 verbatim below the heading on the repository index page. This setting 132 verbatim below the heading on the repository index page. This setting
104 is deprecated, and will not be supported by cgit-1.0 (use root-desc 133 is deprecated, and will not be supported by cgit-1.0 (use root-desc
105 instead). Default value: none. 134 instead). Default value: none.
106 135
107local-time 136local-time::
108 Flag which, if set to "1", makes cgit print commit and tag times in the 137 Flag which, if set to "1", makes cgit print commit and tag times in the
109 servers timezone. Default value: "0". 138 servers timezone. Default value: "0".
110 139
111logo 140logo::
112 Url which specifies the source of an image which will be used as a logo 141 Url which specifies the source of an image which will be used as a logo
113 on all cgit pages. 142 on all cgit pages. Default value: "/cgit.png".
114 143
115logo-link 144logo-link::
116 Url loaded when clicking on the cgit logo image. If unspecified the 145 Url loaded when clicking on the cgit logo image. If unspecified the
117 calculated url of the repository index page will be used. Default 146 calculated url of the repository index page will be used. Default
118 value: none. 147 value: none.
119 148
120max-commit-count 149max-commit-count::
121 Specifies the number of entries to list per page in "log" view. Default 150 Specifies the number of entries to list per page in "log" view. Default
122 value: "50". 151 value: "50".
123 152
124max-message-length 153max-message-length::
125 Specifies the maximum number of commit message characters to display in 154 Specifies the maximum number of commit message characters to display in
126 "log" view. Default value: "80". 155 "log" view. Default value: "80".
127 156
128max-repo-count 157max-repo-count::
129 Specifies the number of entries to list per page on the repository 158 Specifies the number of entries to list per page on the repository
130 index page. Default value: "50". 159 index page. Default value: "50".
131 160
132max-repodesc-length 161max-repodesc-length::
133 Specifies the maximum number of repo description characters to display 162 Specifies the maximum number of repo description characters to display
134 on the repository index page. Default value: "80". 163 on the repository index page. Default value: "80".
135 164
136max-stats 165max-stats::
137 Set the default maximum statistics period. Valid values are "week", 166 Set the default maximum statistics period. Valid values are "week",
138 "month", "quarter" and "year". If unspecified, statistics are 167 "month", "quarter" and "year". If unspecified, statistics are
139 disabled. Default value: none. See also: "repo.max-stats". 168 disabled. Default value: none. See also: "repo.max-stats".
140 169
141module-link 170mimetype.<ext>::
171 Set the mimetype for the specified filename extension. This is used
172 by the `plain` command when returning blob content.
173
174module-link::
142 Text which will be used as the formatstring for a hyperlink when a 175 Text which will be used as the formatstring for a hyperlink when a
143 submodule is printed in a directory listing. The arguments for the 176 submodule is printed in a directory listing. The arguments for the
144 formatstring are the path and SHA1 of the submodule commit. Default 177 formatstring are the path and SHA1 of the submodule commit. Default
145 value: "./?repo=%s&page=commit&id=%s" 178 value: "./?repo=%s&page=commit&id=%s"
146 179
147nocache 180nocache::
148 If set to the value "1" caching will be disabled. This settings is 181 If set to the value "1" caching will be disabled. This settings is
149 deprecated, and will not be honored starting with cgit-1.0. Default 182 deprecated, and will not be honored starting with cgit-1.0. Default
150 value: "0". 183 value: "0".
151 184
152renamelimit 185noplainemail::
186 If set to "1" showing full author email adresses will be disabled.
187 Default value: "0".
188
189noheader::
190 Flag which, when set to "1", will make cgit omit the standard header
191 on all pages. Default value: none. See also: "embedded".
192
193renamelimit::
153 Maximum number of files to consider when detecting renames. The value 194 Maximum number of files to consider when detecting renames. The value
154 "-1" uses the compiletime value in git (for further info, look at 195 "-1" uses the compiletime value in git (for further info, look at
155 `man git-diff`). Default value: "-1". 196 `man git-diff`). Default value: "-1".
156 197
157repo.group 198repo.group::
158 A value for the current repository group, which all repositories 199 A value for the current repository group, which all repositories
159 specified after this setting will inherit. Default value: none. 200 specified after this setting will inherit. Default value: none.
160 201
161robots 202robots::
162 Text used as content for the "robots" meta-tag. Default value: 203 Text used as content for the "robots" meta-tag. Default value:
163 "index, nofollow". 204 "index, nofollow".
164 205
165root-desc 206root-desc::
166 Text printed below the heading on the repository index page. Default 207 Text printed below the heading on the repository index page. Default
167 value: "a fast webinterface for the git dscm". 208 value: "a fast webinterface for the git dscm".
168 209
169root-readme: 210root-readme::
170 The content of the file specified with this option will be included 211 The content of the file specified with this option will be included
171 verbatim below the "about" link on the repository index page. Default 212 verbatim below the "about" link on the repository index page. Default
172 value: none. 213 value: none.
173 214
174root-title 215root-title::
175 Text printed as heading on the repository index page. Default value: 216 Text printed as heading on the repository index page. Default value:
176 "Git Repository Browser". 217 "Git Repository Browser".
177 218
178snapshots 219snapshots::
179 Text which specifies the default (and allowed) set of snapshot formats 220 Text which specifies the default (and allowed) set of snapshot formats
180 supported by cgit. The value is a space-separated list of zero or more 221 supported by cgit. The value is a space-separated list of zero or more
181 of the following values: 222 of the following values:
@@ -185,19 +226,27 @@ snapshots
185 "zip" zip-file 226 "zip" zip-file
186 Default value: none. 227 Default value: none.
187 228
188summary-branches 229source-filter::
230 Specifies a command which will be invoked to format plaintext blobs
231 in the tree view. The command will get the blob content on its STDIN
232 and the name of the blob as its only command line argument. The STDOUT