cgitrc.5.txt (view raw)
1:man source: cgit
2:man manual: cgit
3
4CGITRC(5)
5========
6
7
8NAME
9----
10cgitrc - runtime configuration for cgit
11
12
13SYNOPSIS
14--------
15Cgitrc contains all runtime settings for cgit, including the list of git
16repositories, formatted as a line-separated list of NAME=VALUE pairs. Blank
17lines, and lines starting with '#', are ignored.
18
19
20LOCATION
21--------
22The default location of cgitrc, defined at compile time, is /etc/cgitrc. At
23runtime, cgit will consult the environment variable CGIT_CONFIG and, if
24defined, use its value instead.
25
26
27GLOBAL SETTINGS
28---------------
29about-filter::
30 Specifies a command which will be invoked to format the content of
31 about pages (both top-level and for each repository). The command will
32 get the content of the about-file on its STDIN, the name of the file
33 as the first argument, and the STDOUT from the command will be
34 included verbatim on the about page. Default value: none. See
35 also: "FILTER API".
36
37agefile::
38 Specifies a path, relative to each repository path, which can be used
39 to specify the date and time of the youngest commit in the repository.
40 The first line in the file is used as input to the "parse_date"
41 function in libgit. Recommended timestamp-format is "yyyy-mm-dd
42 hh:mm:ss". You may want to generate this file from a post-receive
43 hook. Default value: "info/web/last-modified".
44
45auth-filter::
46 Specifies a command that will be invoked for authenticating repository
47 access. Receives quite a few arguments, and data on both stdin and
48 stdout for authentication processing. Details follow later in this
49 document. If no auth-filter is specified, no authentication is
50 performed. Default value: none. See also: "FILTER API".
51
52branch-sort::
53 Flag which, when set to "age", enables date ordering in the branch ref
54 list, and when set to "name" enables ordering by branch name. Default
55 value: "name".
56
57cache-root::
58 Path used to store the cgit cache entries. Default value:
59 "/var/cache/cgit". See also: "MACRO EXPANSION".
60
61cache-static-ttl::
62 Number which specifies the time-to-live, in minutes, for the cached
63 version of repository pages accessed with a fixed SHA1. See also:
64 "CACHE". Default value: -1".
65
66cache-dynamic-ttl::
67 Number which specifies the time-to-live, in minutes, for the cached
68 version of repository pages accessed without a fixed SHA1. See also:
69 "CACHE". Default value: "5".
70
71cache-repo-ttl::
72 Number which specifies the time-to-live, in minutes, for the cached
73 version of the repository summary page. See also: "CACHE". Default
74 value: "5".
75
76cache-root-ttl::
77 Number which specifies the time-to-live, in minutes, for the cached
78 version of the repository index page. See also: "CACHE". Default
79 value: "5".
80
81cache-scanrc-ttl::
82 Number which specifies the time-to-live, in minutes, for the result
83 of scanning a path for git repositories. See also: "CACHE". Default
84 value: "15".
85
86cache-about-ttl::
87 Number which specifies the time-to-live, in minutes, for the cached
88 version of the repository about page. See also: "CACHE". Default
89 value: "15".
90
91cache-snapshot-ttl::
92 Number which specifies the time-to-live, in minutes, for the cached
93 version of snapshots. See also: "CACHE". Default value: "5".
94
95cache-size::
96 The maximum number of entries in the cgit cache. When set to "0",
97 caching is disabled. See also: "CACHE". Default value: "0"
98
99case-sensitive-sort::
100 Sort items in the repo list case sensitively. Default value: "1".
101 See also: repository-sort, section-sort.
102
103clone-prefix::
104 Space-separated list of common prefixes which, when combined with a
105 repository url, generates valid clone urls for the repository. This
106 setting is only used if `repo.clone-url` is unspecified. Default value:
107 none.
108
109clone-url::
110 Space-separated list of clone-url templates. This setting is only
111 used if `repo.clone-url` is unspecified. Default value: none. See
112 also: "MACRO EXPANSION", "FILTER API".
113
114commit-filter::
115 Specifies a command which will be invoked to format commit messages.
116 The command will get the message on its STDIN, and the STDOUT from the
117 command will be included verbatim as the commit message, i.e. this can
118 be used to implement bugtracker integration. Default value: none.
119 See also: "FILTER API".
120
121commit-sort::
122 Flag which, when set to "date", enables strict date ordering in the
123 commit log, and when set to "topo" enables strict topological
124 ordering. If unset, the default ordering of "git log" is used. Default
125 value: unset.
126
127css::
128 Url which specifies the css document to include in all cgit pages.
129 Default value: "/cgit.css".
130
131email-filter::
132 Specifies a command which will be invoked to format names and email
133 address of committers, authors, and taggers, as represented in various
134 places throughout the cgit interface. This command will receive an
135 email address and an origin page string as its command line arguments,
136 and the text to format on STDIN. It is to write the formatted text back
137 out onto STDOUT. Default value: none. See also: "FILTER API".
138
139embedded::
140 Flag which, when set to "1", will make cgit generate a html fragment
141 suitable for embedding in other html pages. Default value: none. See
142 also: "noheader".
143
144enable-blame::
145 Flag which, when set to "1", will allow cgit to provide a "blame" page
146 for files, and will make it generate links to that page in appropriate
147 places. Default value: "0".
148
149enable-commit-graph::
150 Flag which, when set to "1", will make cgit print an ASCII-art commit
151 history graph to the left of the commit messages in the repository
152 log page. Default value: "0".
153
154enable-filter-overrides::
155 Flag which, when set to "1", allows all filter settings to be
156 overridden in repository-specific cgitrc files. Default value: none.
157
158enable-follow-links::
159 Flag which, when set to "1", allows users to follow a file in the log
160 view. Default value: "0".
161
162enable-http-clone::
163 If set to "1", cgit will act as an dumb HTTP endpoint for git clones.
164 You can add "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL" to clone-url
165 to expose this feature. If you use an alternate way of serving git
166 repositories, you may wish to disable this. Default value: "1".
167
168enable-index-links::
169 Flag which, when set to "1", will make cgit generate extra links for
170 each repo in the repository index (specifically, to the "summary",
171 "commit" and "tree" pages). Default value: "0".
172
173enable-index-owner::
174 Flag which, when set to "1", will make cgit display the owner of
175 each repo in the repository index. Default value: "1".
176
177enable-log-filecount::
178 Flag which, when set to "1", will make cgit print the number of
179 modified files for each commit on the repository log page. Default
180 value: "0".
181
182enable-log-linecount::
183 Flag which, when set to "1", will make cgit print the number of added
184 and removed lines for each commit on the repository log page. Default
185 value: "0".
186
187enable-remote-branches::
188 Flag which, when set to "1", will make cgit display remote branches
189 in the summary and refs views. Default value: "0". See also:
190 "repo.enable-remote-branches".
191
192enable-subject-links::
193 Flag which, when set to "1", will make cgit use the subject of the
194 parent commit as link text when generating links to parent commits
195 in commit view. Default value: "0". See also:
196 "repo.enable-subject-links".
197
198enable-html-serving::
199 Flag which, when set to "1", will allow the /plain handler to serve
200 mimetype headers that result in the file being treated as HTML by the
201 browser. When set to "0", such file types are returned instead as
202 text/plain or application/octet-stream. Default value: "0". See also:
203 "repo.enable-html-serving".
204
205enable-tree-linenumbers::
206 Flag which, when set to "1", will make cgit generate linenumber links
207 for plaintext blobs printed in the tree view. Default value: "1".
208
209enable-git-config::
210 Flag which, when set to "1", will allow cgit to use git config to set
211 any repo specific settings. This option is used in conjunction with
212 "scan-path", and must be defined prior, to augment repo-specific
213 settings. The keys gitweb.owner, gitweb.category, gitweb.description,
214 and gitweb.homepage will map to the cgit keys repo.owner, repo.section,
215 repo.desc, and repo.homepage respectively. All git config keys that begin
216 with "cgit." will be mapped to the corresponding "repo." key in cgit.
217 Default value: "0". See also: scan-path, section-from-path.
218
219favicon::
220 Url used as link to a shortcut icon for cgit. It is suggested to use
221 the value "/favicon.ico" since certain browsers will ignore other
222 values. Default value: "/favicon.ico".
223
224footer::
225 The content of the file specified with this option will be included
226 verbatim at the bottom of all pages (i.e. it replaces the standard
227 "generated by..." message. Default value: none.
228
229head-include::
230 The content of the file specified with this option will be included
231 verbatim in the html HEAD section on all pages. Default value: none.
232
233header::
234 The content of the file specified with this option will be included
235 verbatim at the top of all pages. Default value: none.
236
237include::
238 Name of a configfile to include before the rest of the current config-
239 file is parsed. Default value: none. See also: "MACRO EXPANSION".
240
241index-header::
242 The content of the file specified with this option will be included
243 verbatim above the repository index. This setting is deprecated, and
244 will not be supported by cgit-1.0 (use root-readme instead). Default
245 value: none.
246
247index-info::
248 The content of the file specified with this option will be included
249 verbatim below the heading on the repository index page. This setting
250 is deprecated, and will not be supported by cgit-1.0 (use root-desc
251 instead). Default value: none.
252
253local-time::
254 Flag which, if set to "1", makes cgit print commit and tag times in the
255 servers timezone. Default value: "0".
256
257logo::
258 Url which specifies the source of an image which will be used as a logo
259 on all cgit pages. Default value: "/cgit.png".
260
261logo-link::
262 Url loaded when clicking on the cgit logo image. If unspecified the
263 calculated url of the repository index page will be used. Default
264 value: none.
265
266owner-filter::
267 Specifies a command which will be invoked to format the Owner
268 column of the main page. The command will get the owner on STDIN,
269 and the STDOUT from the command will be included verbatim in the
270 table. This can be used to link to additional context such as an
271 owners home page. When active this filter is used instead of the
272 default owner query url. Default value: none.
273 See also: "FILTER API".
274
275max-atom-items::
276 Specifies the number of items to display in atom feeds view. Default
277 value: "10".
278
279max-commit-count::
280 Specifies the number of entries to list per page in "log" view. Default
281 value: "50".
282
283max-message-length::
284 Specifies the maximum number of commit message characters to display in
285 "log" view. Default value: "80".
286
287max-repo-count::
288 Specifies the number of entries to list per page on the repository
289 index page. Default value: "50".
290
291max-repodesc-length::
292 Specifies the maximum number of repo description characters to display
293 on the repository index page. Default value: "80".
294
295max-blob-size::
296 Specifies the maximum size of a blob to display HTML for in KBytes.
297 Default value: "0" (limit disabled).
298
299max-stats::
300 Set the default maximum statistics period. Valid values are "week",
301 "month", "quarter" and "year". If unspecified, statistics are
302 disabled. Default value: none. See also: "repo.max-stats".
303
304mimetype.<ext>::
305 Set the mimetype for the specified filename extension. This is used
306 by the `plain` command when returning blob content.
307
308mimetype-file::
309 Specifies the file to use for automatic mimetype lookup. If specified
310 then this field is used as a fallback when no "mimetype.<ext>" match is
311 found. If unspecified then no such lookup is performed. The typical file
312 to use on a Linux system is /etc/mime.types. The format of the file must
313 comply to:
314 - a comment line is an empty line or a line starting with a hash (#),
315 optionally preceded by whitespace
316 - a non-comment line starts with the mimetype (like image/png), followed
317 by one or more file extensions (like jpg), all separated by whitespace
318 Default value: none. See also: "mimetype.<ext>".
319
320module-link::
321 Text which will be used as the formatstring for a hyperlink when a
322 submodule is printed in a directory listing. The arguments for the
323 formatstring are the path and SHA1 of the submodule commit. Default
324 value: none.
325
326nocache::
327 If set to the value "1" caching will be disabled. This settings is
328 deprecated, and will not be honored starting with cgit-1.0. Default
329 value: "0".
330
331noplainemail::
332 If set to "1" showing full author email addresses will be disabled.
333 Default value: "0".
334
335noheader::
336 Flag which, when set to "1", will make cgit omit the standard header
337 on all pages. Default value: none. See also: "embedded".
338
339project-list::
340 A list of subdirectories inside of scan-path, relative to it, that
341 should loaded as git repositories. This must be defined prior to
342 scan-path. Default value: none. See also: scan-path, "MACRO
343 EXPANSION".
344
345readme::
346 Text which will be used as default value for "repo.readme". Multiple
347 config keys may be specified, and cgit will use the first found file
348 in this list. This is useful in conjunction with scan-path. Default
349 value: none. See also: scan-path, repo.readme.
350
351remove-suffix::
352 If set to "1" and scan-path is enabled, if any repositories are found
353 with a suffix of ".git", this suffix will be removed for the url and
354 name. This must be defined prior to scan-path. Default value: "0".
355 See also: scan-path.
356
357renamelimit::
358 Maximum number of files to consider when detecting renames. The value
359 "-1" uses the compiletime value in git (for further info, look at
360 `man git-diff`). Default value: "-1".
361
362repo.group::
363 Legacy alias for "section". This option is deprecated and will not be
364 supported in cgit-1.0.
365
366repository-sort::
367 The way in which repositories in each section are sorted. Valid values
368 are "name" for sorting by the repo name or "age" for sorting by the
369 most recently updated repository. Default value: "name". See also:
370 section, case-sensitive-sort, section-sort.
371
372robots::
373 Text used as content for the "robots" meta-tag. Default value:
374 "index, nofollow".
375
376root-desc::
377 Text printed below the heading on the repository index page. Default
378 value: "a fast webinterface for the git dscm".
379
380root-readme::
381 The content of the file specified with this option will be included
382 verbatim below the "about" link on the repository index page. Default
383 value: none.
384
385root-title::
386 Text printed as heading on the repository index page. Default value:
387 "Git Repository Browser".
388
389scan-hidden-path::
390 If set to "1" and scan-path is enabled, scan-path will recurse into
391 directories whose name starts with a period ('.'). Otherwise,
392 scan-path will stay away from such directories (considered as
393 "hidden"). Note that this does not apply to the ".git" directory in
394 non-bare repos. This must be defined prior to scan-path.
395 Default value: 0. See also: scan-path.
396
397scan-path::
398 A path which will be scanned for repositories. If caching is enabled,
399 the result will be cached as a cgitrc include-file in the cache
400 directory. If project-list has been defined prior to scan-path,
401 scan-path loads only the directories listed in the file pointed to by
402 project-list. Be advised that only the global settings taken
403 before the scan-path directive will be applied to each repository.
404 Default value: none. See also: cache-scanrc-ttl, project-list,
405 "MACRO EXPANSION".
406
407section::
408 The name of the current repository section - all repositories defined
409 after this option will inherit the current section name. Default value:
410 none.
411
412section-sort::
413 Flag which, when set to "1", will sort the sections on the repository
414 listing by name. Set this flag to "0" if the order in the cgitrc file should
415 be preserved. Default value: "1". See also: section,
416 case-sensitive-sort, repository-sort.
417
418section-from-path::
419 A number which, if defined prior to scan-path, specifies how many
420 path elements from each repo path to use as a default section name.
421 If negative, cgit will discard the specified number of path elements
422 above the repo directory. Default value: "0".
423
424side-by-side-diffs::
425 If set to "1" shows side-by-side diffs instead of unidiffs per
426 default. Default value: "0".
427
428snapshots::
429 Text which specifies the default set of snapshot formats that cgit
430 generates links for. The value is a space-separated list of zero or
431 more of the values "tar", "tar.gz", "tar.bz2", "tar.xz" and "zip".
432 Default value: none.
433
434source-filter::
435 Specifies a command which will be invoked to format plaintext blobs
436 in the tree view. The command will get the blob content on its STDIN
437 and the name of the blob as its only command line argument. The STDOUT
438 from the command will be included verbatim as the blob contents, i.e.
439 this can be used to implement e.g. syntax highlighting. Default value:
440 none. See also: "FILTER API".
441
442summary-branches::
443 Specifies the number of branches to display in the repository "summary"
444 view. Default value: "10".
445
446summary-log::
447 Specifies the number of log entries to display in the repository
448 "summary" view. Default value: "10".
449
450summary-tags::
451 Specifies the number of tags to display in the repository "summary"
452 view. Default value: "10".
453
454strict-export::
455 Filename which, if specified, needs to be present within the repository
456 for cgit to allow access to that repository. This can be used to emulate
457 gitweb's EXPORT_OK and STRICT_EXPORT functionality and limit cgit's
458 repositories to match those exported by git-daemon. This option must
459 be defined prior to scan-path.
460
461virtual-root::
462 Url which, if specified, will be used as root for all cgit links. It
463 will also cause cgit to generate 'virtual urls', i.e. urls like
464 '/cgit/tree/README' as opposed to '?r=cgit&p=tree&path=README'. Default
465 value: none.
466 NOTE: cgit has recently learned how to use PATH_INFO to achieve the
467 same kind of virtual urls, so this option will probably be deprecated.
468
469
470REPOSITORY SETTINGS
471-------------------
472repo.about-filter::
473 Override the default about-filter. Default value: none. See also:
474 "enable-filter-overrides". See also: "FILTER API".
475
476repo.branch-sort::
477 Flag which, when set to "age", enables date ordering in the branch ref
478 list, and when set to "name" enables ordering by branch name. Default
479 value: "name".
480
481repo.clone-url::
482 A list of space-separated urls which can be used to clone this repo.
483 Default value: none. See also: "MACRO EXPANSION".
484
485repo.commit-filter::
486 Override the default commit-filter. Default value: none. See also:
487 "enable-filter-overrides". See also: "FILTER API".
488
489repo.commit-sort::
490 Flag which, when set to "date", enables strict date ordering in the
491 commit log, and when set to "topo" enables strict topological
492 ordering. If unset, the default ordering of "git log" is used. Default
493 value: unset.
494
495repo.defbranch::
496 The name of the default branch for this repository. If no such branch
497 exists in the repository, the first branch name (when sorted) is used
498 as default instead. Default value: branch pointed to by HEAD, or
499 "master" if there is no suitable HEAD.
500
501repo.desc::
502 The value to show as repository description. Default value: none.
503
504repo.homepage::
505 The value to show as repository homepage. Default value: none.
506
507repo.email-filter::
508 Override the default email-filter. Default value: none. See also:
509 "enable-filter-overrides". See also: "FILTER API".
510
511repo.enable-commit-graph::
512 A flag which can be used to disable the global setting
513 `enable-commit-graph'. Default value: none.
514
515repo.enable-log-filecount::
516 A flag which can be used to disable the global setting
517 `enable-log-filecount'. Default value: none.
518
519repo.enable-log-linecount::
520 A flag which can be used to disable the global setting
521 `enable-log-linecount'. Default value: none.
522
523repo.enable-remote-branches::
524 Flag which, when set to "1", will make cgit display remote branches
525 in the summary and refs views. Default value: <enable-remote-branches>.
526
527repo.enable-subject-links::
528 A flag which can be used to override the global setting
529 `enable-subject-links'. Default value: none.
530
531repo.enable-html-serving::
532 A flag which can be used to override the global setting
533 `enable-html-serving`. Default value: none.
534
535repo.hide::
536 Flag which, when set to "1", hides the repository from the repository
537 index. The repository can still be accessed by providing a direct path.
538 Default value: "0". See also: "repo.ignore".
539
540repo.ignore::
541 Flag which, when set to "1", ignores the repository. The repository
542 is not shown in the index and cannot be accessed by providing a direct
543 path. Default value: "0". See also: "repo.hide".
544
545repo.logo::
546 Url which specifies the source of an image which will be used as a logo
547 on this repo's pages. Default value: global logo.
548
549repo.logo-link::
550 Url loaded when clicking on the cgit logo image. If unspecified the
551 calculated url of the repository index page will be used. Default
552 value: global logo-link.
553
554repo.owner-filter::
555 Override the default owner-filter. Default value: none. See also:
556 "enable-filter-overrides". See also: "FILTER API".
557
558repo.module-link::
559 Text which will be used as the formatstring for a hyperlink when a
560 submodule is printed in a directory listing. The arguments for the
561 formatstring are the path and SHA1 of the submodule commit. Default
562 value: <module-link>
563
564repo.module-link.<path>::
565 Text which will be used as the formatstring for a hyperlink when a
566 submodule with the specified subdirectory path is printed in a
567 directory listing. The only argument for the formatstring is the SHA1
568 of the submodule commit. Default value: none.
569
570repo.max-stats::
571 Override the default maximum statistics period. Valid values are equal
572 to the values specified for the global "max-stats" setting. Default
573 value: none.
574
575repo.name::
576 The value to show as repository name. Default value: <repo.url>.
577
578repo.owner::
579 A value used to identify the owner of the repository. Default value:
580 none.
581
582repo.path::
583 An absolute path to the repository directory. For non-bare repositories
584 this is the .git-directory. Default value: none.
585
586repo.readme::
587 A path (relative to <repo.path>) which specifies a file to include
588 verbatim as the "About" page for this repo. You may also specify a
589 git refspec by head or by hash by prepending the refspec followed by
590 a colon. For example, "master:docs/readme.mkd". If the value begins
591 with a colon, i.e. ":docs/readme.rst", the default branch of the
592 repository will be used. Sharing any file will expose that entire
593 directory tree to the "/about/PATH" endpoints, so be sure that there
594 are no non-public files located in the same directory as the readme
595 file. Default value: <readme>.
596
597repo.snapshots::
598 A mask of snapshot formats for this repo that cgit generates links for,
599 restricted by the global "snapshots" setting. Default value:
600 <snapshots>.
601
602repo.snapshot-prefix::
603 Prefix to use for snapshot links instead of the repository basename.
604 For example, the "linux-stable" repository may wish to set this to
605 "linux" so that snapshots are in the format "linux-3.15.4" instead
606 of "linux-stable-3.15.4". Default value: <empty> meaning to use
607 the repository basename.
608
609repo.section::
610 Override the current section name for this repository. Default value:
611 none.
612
613repo.source-filter::
614 Override the default source-filter. Default value: none. See also:
615 "enable-filter-overrides". See also: "FILTER API".
616
617repo.url::
618 The relative url used to access the repository. This must be the first
619 setting specified for each repo. Default value: none.
620
621
622REPOSITORY-SPECIFIC CGITRC FILE
623-------------------------------
624When the option "scan-path" is used to auto-discover git repositories, cgit
625will try to parse the file "cgitrc" within any found repository. Such a
626repo-specific config file may contain any of the repo-specific options
627described above, except "repo.url" and "repo.path". Additionally, the "filter"
628options are only acknowledged in repo-specific config files when
629"enable-filter-overrides" is set to "1".
630
631Note: the "repo." prefix is dropped from the option names in repo-specific
632config files, e.g. "repo.desc" becomes "desc".
633
634
635FILTER API
636----------
637By default, filters are separate processes that are executed each time they
638are needed. Alternative technologies may be used by prefixing the filter
639specification with the relevant string; available values are:
640
641'exec:'::
642 The default "one process per filter" mode.
643
644'lua:'::
645 Executes the script using a built-in Lua interpreter. The script is
646 loaded once per execution of cgit, and may be called multiple times
647 during cgit's lifetime, making it a good choice for repeated filters
648 such as the 'email filter'. It responds to three functions:
649
650 'filter_open(argument1, argument2, argument3, ...)'::
651 This is called upon activation of the filter for a particular
652 set of data.
653 'filter_write(buffer)'::
654 This is called whenever cgit writes data to the webpage.
655 'filter_close()'::
656 This is called when the current filtering operation is
657 completed. It must return an integer value. Usually 0
658 indicates success.
659
660 Additionally, cgit exposes to the Lua the following built-in functions:
661
662 'html(str)'::
663 Writes 'str' to the webpage.
664 'html_txt(str)'::
665 HTML escapes and writes 'str' to the webpage.
666 'html_attr(str)'::
667 HTML escapes for an attribute and writes "str' to the webpage.
668 'html_url_path(str)'::
669 URL escapes for a path and writes 'str' to the webpage.
670 'html_url_arg(str)'::
671 URL escapes for an argument and writes 'str' to the webpage.
672 'html_include(file)'::
673 Includes 'file' in webpage.
674
675
676Parameters are provided to filters as follows.
677
678about filter::
679 This filter is given a single parameter: the filename of the source
680 file to filter. The filter can use the filename to determine (for
681 example) the type of syntax to follow when formatting the readme file.
682 The about text that is to be filtered is available on standard input
683 and the filtered text is expected on standard output.
684
685commit filter::
686 This filter is given no arguments. The commit message text that is to
687 be filtered is available on standard input and the filtered text is
688 expected on standard output.
689
690email filter::
691 This filter is given two parameters: the email address of the relevant
692 author and a string indicating the originating page. The filter will
693 then receive the text string to format on standard input and is
694 expected to write to standard output the formatted text to be included
695 in the page.
696
697owner filter::
698 This filter is given no arguments. The owner text is available on
699 standard input and the filter is expected to write to standard
700 output. The output is included in the Owner column.
701
702source filter::
703 This filter is given a single parameter: the filename of the source
704 file to filter. The filter can use the filename to determine (for
705 example) the syntax highlighting mode. The contents of the source
706 file that is to be filtered is available on standard input and the
707 filtered contents is expected on standard output.
708
709auth filter::
710 The authentication filter receives 12 parameters:
711 - filter action, explained below, which specifies which action the
712 filter is called for
713 - http cookie
714 - http method
715 - http referer
716 - http path
717 - http https flag
718 - cgit repo
719 - cgit page
720 - cgit url
721 - cgit login url
722 When the filter action is "body", this filter must write to output the
723 HTML for displaying the login form, which POSTs to the login url. When
724 the filter action is "authenticate-cookie", this filter must validate
725 the http cookie and return a 0 if it is invalid or 1 if it is invalid,
726 in the exit code / close function. If the filter action is
727 "authenticate-post", this filter receives POST'd parameters on
728 standard input, and should write a complete CGI response, preferably
729 with a 302 redirect, and write to output one or more "Set-Cookie"
730 HTTP headers, each followed by a newline.
731
732 Please see `filters/simple-authentication.lua` for a clear example
733 script that may be modified.
734
735
736All filters are handed the following environment variables:
737
738- CGIT_REPO_URL (from repo.url)
739- CGIT_REPO_NAME (from repo.name)
740- CGIT_REPO_PATH (from repo.path)
741- CGIT_REPO_OWNER (from repo.owner)
742- CGIT_REPO_DEFBRANCH (from repo.defbranch)
743- CGIT_REPO_SECTION (from repo.section)
744- CGIT_REPO_CLONE_URL (from repo.clone-url)
745
746If a setting is not defined for a repository and the corresponding global
747setting is also not defined (if applicable), then the corresponding
748environment variable will be unset.
749
750
751MACRO EXPANSION
752---------------
753The following cgitrc options support a simple macro expansion feature,
754where tokens prefixed with "$" are replaced with the value of a similarly
755named environment variable:
756
757- cache-root
758- include
759- project-list
760- scan-path
761
762Macro expansion will also happen on the content of $CGIT_CONFIG, if
763defined.
764
765One usage of this feature is virtual hosting, which in its simplest form
766can be accomplished by adding the following line to /etc/cgitrc:
767
768 include=/etc/cgitrc.d/$HTTP_HOST
769
770The following options are expanded during request processing, and support
771the environment variables defined in "FILTER API":
772
773- clone-url
774- repo.clone-url
775
776
777CACHE
778------
779
780All cache ttl values are in minutes. Negative ttl values indicate that a page
781type will never expire, and thus the first time a URL is accessed, the result
782will be cached indefinitely, even if the underlying git repository changes.
783Conversely, when a ttl value is zero, the cache is disabled for that
784particular page type, and the page type is never cached.
785
786
787EXAMPLE CGITRC FILE
788-------------------
789
790....
791# Enable caching of up to 1000 output entries
792cache-size=1000
793
794
795# Specify some default clone urls using macro expansion
796clone-url=git://foo.org/$CGIT_REPO_URL git@foo.org:$CGIT_REPO_URL
797
798# Specify the css url
799css=/css/cgit.css
800
801
802# Show owner on index page
803enable-index-owner=1
804
805
806# Allow http transport git clone
807enable-http-clone=1
808
809
810# Show extra links for each repository on the index page
811enable-index-links=1
812
813
814# Enable blame page and create links to it from tree page
815enable-blame=1
816
817
818# Enable ASCII art commit history graph on the log pages
819enable-commit-graph=1
820
821
822# Show number of affected files per commit on the log pages
823enable-log-filecount=1
824
825
826# Show number of added/removed lines per commit on the log pages
827enable-log-linecount=1
828
829
830# Sort branches by date
831branch-sort=age
832
833
834# Add a cgit favicon
835favicon=/favicon.ico
836
837
838# Use a custom logo
839logo=/img/mylogo.png
840
841
842# Enable statistics per week, month and quarter
843max-stats=quarter
844
845
846# Set the title and heading of the repository index page
847root-title=example.com git repositories
848
849
850# Set a subheading for the repository index page
851root-desc=tracking the foobar development
852
853
854# Include some more info about example.com on the index page
855root-readme=/var/www/htdocs/about.html
856
857
858# Allow download of tar.gz, tar.bz2 and zip-files
859snapshots=tar.gz tar.bz2 zip
860
861
862##
863## List of common mimetypes
864##
865
866mimetype.gif=image/gif
867mimetype.html=text/html
868mimetype.jpg=image/jpeg
869mimetype.jpeg=image/jpeg
870mimetype.pdf=application/pdf
871mimetype.png=image/png
872mimetype.svg=image/svg+xml
873
874
875# Highlight source code with python pygments-based highlighter
876source-filter=/var/www/cgit/filters/syntax-highlighting.py
877
878# Format markdown, restructuredtext, manpages, text files, and html files
879# through the right converters
880about-filter=/var/www/cgit/filters/about-formatting.sh
881
882##
883## Search for these files in the root of the default branch of repositories
884## for coming up with the about page:
885##
886readme=:README.md
887readme=:readme.md
888readme=:README.mkd
889readme=:readme.mkd
890readme=:README.rst
891readme=:readme.rst
892readme=:README.html
893readme=:readme.html
894readme=:README.htm
895readme=:readme.htm
896readme=:README.txt
897readme=:readme.txt
898readme=:README
899readme=:readme
900readme=:INSTALL.md
901readme=:install.md
902readme=:INSTALL.mkd
903readme=:install.mkd
904readme=:INSTALL.rst
905readme=:install.rst
906readme=:INSTALL.html
907readme=:install.html
908readme=:INSTALL.htm
909readme=:install.htm
910readme=:INSTALL.txt
911readme=:install.txt
912readme=:INSTALL
913readme=:install
914
915
916##
917## List of repositories.
918## PS: Any repositories listed when section is unset will not be
919## displayed under a section heading
920## PPS: This list could be kept in a different file (e.g. '/etc/cgitrepos')
921## and included like this:
922## include=/etc/cgitrepos
923##
924
925
926repo.url=foo
927repo.path=/pub/git/foo.git
928repo.desc=the master foo repository
929repo.owner=fooman@example.com
930repo.readme=info/web/about.html
931
932
933repo.url=bar
934repo.path=/pub/git/bar.git
935repo.desc=the bars for your foo
936repo.owner=barman@example.com
937repo.readme=info/web/about.html
938
939
940# The next repositories will be displayed under the 'extras' heading
941section=extras
942
943
944repo.url=baz
945repo.path=/pub/git/baz.git
946repo.desc=a set of extensions for bar users
947
948repo.url=wiz
949repo.path=/pub/git/wiz.git
950repo.desc=the wizard of foo
951
952
953# Add some mirrored repositories
954section=mirrors
955
956
957repo.url=git
958repo.path=/pub/git/git.git
959repo.desc=the dscm
960
961
962repo.url=linux
963repo.path=/pub/git/linux.git
964repo.desc=the kernel
965
966# Disable adhoc downloads of this repo
967repo.snapshots=0
968
969# Disable line-counts for this repo
970repo.enable-log-linecount=0
971
972# Restrict the max statistics period for this repo
973repo.max-stats=month
974....
975
976
977BUGS
978----
979Comments currently cannot appear on the same line as a setting; the comment
980will be included as part of the value. E.g. this line:
981
982 robots=index # allow indexing
983
984will generate the following html element:
985
986 <meta name='robots' content='index # allow indexing'/>
987
988
989
990AUTHOR
991------
992Lars Hjemli <hjemli@gmail.com>
993Jason A. Donenfeld <Jason@zx2c4.com>