gitweb/indextext_readonly.html: include sample readonly file
[girocco.git] / gitweb / gitweb_config.perl
bloba39041ee68261d237f1098c633c8cbde5356d8f0
1 # Pull Girocco config
2 use lib "__BASEDIR__";
3 use Girocco::Config;
4 use Girocco::Util qw(url_path git_add_config is_readonly);
5 use Digest::MD5 qw(md5_hex);
6 BEGIN {
7 eval { require HTML::Email::Obfuscate; 1 } or
8 eval {
9 require Girocco::Email::Obfuscate;
10 $INC{'HTML/Email/Obfuscate.pm'} = $INC{'Girocco/Email/Obfuscate.pm'}; # mwahaha
13 BEGIN {
14 # Redirect use of the FCGI/CGI::Fast module to the pure Perl substitute
15 # unless both the FCGI and CGI::Fast modules are actually present.
16 # However, if one or both of FCGI/CGI::Fast has already been use'd don't
17 # bother doing anything since it's too late to redirect at that point.
18 my $hasinc = sub {
19 do {my $f = $_."/".$_[0]; return $f if -f $f}
20 foreach grep(!ref($_),@INC);
21 return undef;
23 my $gd = sub {my $l=1; return sub {$_=$l?"1;":"";$l--}};
24 my $pre = sub {
25 if ($_[1] eq 'CGI/Fast.pm' && !$INC{'FCGI.pm'} or
26 $_[1] eq 'FCGI.pm' && !$INC{'CGI/Fast.pm'}) {
27 if (!&$hasinc('CGI/Fast.pm') || !&$hasinc('FCGI.pm')) {
28 require 'Girocco/extra/CGI/FCGI.pm';
29 return &$gd;
32 return ();
34 unshift(@INC, $pre);
37 ## For the complete overview of available configuration options,
38 ## see git.git/gitweb/gitweb.perl file beginning (git.git/gitweb/README
39 ## may miss some custom patches, in theory).
41 # make sure these are available to make this config file "use"able outside
42 # gitweb.cgi -- everything else in this file already has an explicit "our".
43 our %feature;
44 our %html_cache_actions;
46 # rename detection options for git-diff and git-diff-tree (default is '-M')
47 our @diff_opts = ('-B', '-C');
49 # Whether to include project list on the gitweb front page; 0 means yes,
50 # 1 means no list but show tag cloud if enabled (all projects still need
51 # to be scanned, unless the info is cached), 2 means no list and no tag cloud
52 # (very fast)
53 our $frontpage_no_project_list = 1;
55 ## projects list cache for busy sites with many projects;
56 ## if you set this to non-zero, it will be used as the cached
57 ## index lifetime in minutes
58 our $projlist_cache_lifetime = 10;
60 ## default charset for text/plain blob
61 our $default_text_plain_charset = 'utf-8';
63 # Comment out to disable ctags or set to 1 for display only
64 $feature{'ctags'}{'default'}=["@{[url_path($Girocco::Config::webadmurl)]}/tagproj.cgi"];
65 #$feature{'ctags'}{'default'}=[1]; # display-only setting (no add tag box on summary page)
67 $feature{'blame'}{'default'}=[1];
68 $feature{'blame_incremental'}{'default'}=[1];
70 $feature{'snapshot'}{'default'} = ['tgz', 'zip'];
72 # Enable override to turn off snapshots on a per-repository basis with config gitweb.snapshot=none
73 #$feature{'snapshot'}{'override'} = 1;
75 # Change this from 1 to 0 to disable all searching
76 # (it's enabled by default so commenting this out will still leave it enabled)
77 # Note that project-specific override is NOT supported for this option!
78 $feature{'search'}{'default'}=[1];
80 # Change this from 0 to 1 to enable git regular expression searches
81 # (they can be CPU/memory intensive when malicious regular expressions are used)
82 # (they're enabled by default so commenting this out will leave them enabled)
83 $feature{'regexp'}{'default'}=[0];
85 # Enable override to control regexp on a per-repository basis with config gitweb.regexp=<bool>
86 #$feature{'regexp'}{'override'} = 1;
88 # Change this from 0 to 1 to enable grep searches (they can be CPU intensive)
89 # (it's enabled by default so commenting this out will leave it enabled)
90 # Note that it will be automatically disabled if 'search' is disabled.
91 $feature{'grep'}{'default'}=[0];
93 # Enable override to control grep on a per-repository basis with config gitweb.grep=<bool>
94 #$feature{'grep'}{'override'} = 1;
96 # Change this from 0 to 1 to enable pickaxe searches (they can be CPU intensive)
97 # (it's enabled by default so commenting this out will leave it enabled)
98 # Note that it will be automatically disabled if 'search' is disabled.
99 $feature{'pickaxe'}{'default'}=[0];
101 # Enable override to control pickaxe on a per-repository basis with config gitweb.pickaxe=<bool>
102 #$feature{'pickaxe'}{'override'} = 1;
104 # Enable this to highlight sources if highlight is available
105 #$feature{'highlight'}{'default'} = [1];
107 # Set this if highlight is enabled and not available as 'highlight' in $PATH
108 # You should set this to the full absolute path to highlight whenever highlight
109 # cannot be found in any of the `getconf PATH` directories.
110 #our $highlight_bin = "highlight";
112 # the width (in characters) of the projects list "Description" column
113 # (the default is only 25 if this is not set)
114 our $projects_list_description_width = 40;
117 ### You probably don't really want to tweak anything below.
120 # Base web full url
121 our $my_url = $Girocco::Config::gitweburl;
123 # Base web path absolute url except "/" should be ""
124 our $my_uri = url_path($Girocco::Config::gitweburl);
126 # Base web path absolute url
127 our $base_url = url_path($Girocco::Config::gitweburl,1);
129 ## git base URL used for URL to fetch bundle information page
130 ## i.e. full URL is "$git_base_bundles_url/$project/bundles"
131 our $git_base_bundles_url = url_path($Girocco::Config::bundlesurl);
133 # https hint html inserted right after any https push URL (undef for none)
134 # e.g. "<a href="https_push_instructions.html">https push instructions</a>"
135 our $https_hint_html = undef;
136 $https_hint_html = substr(<<HINT,0,-1) if $Girocco::Config::httpspushurl;
137 <sup class="sup"><span><a href="@{[url_path($Girocco::Config::htmlurl)]}/httpspush.html">(learn&#160;more)</a></span></sup>
138 HINT
140 # owner link hook given owner name (full and NOT obfuscated)
141 # should return full URL-escaped link to attach to owner, for example:
142 # sub { return "/showowner.cgi?owner=".CGI::Util::escape($_[0]); }
143 our $owner_link_hook = undef;
144 $owner_link_hook = sub { url_path($Girocco::Config::webadmurl)."/projlist.cgi?name=".md5_hex(lc($_[0])); };
146 # Path to a POSIX shell. Needed to run $highlight_bin and a snapshot compressor.
147 # Only used when highlight is enabled or snapshots with compressors are enabled.
148 our $posix_shell_bin;
149 $posix_shell_bin = $Girocco::Config::posix_sh_bin if $Girocco::Config::posix_sh_bin;
151 ## core git executable to use
152 ## this can just be "git" if your webserver has a sensible PATH
153 our $GIT = $Girocco::Config::git_bin;
155 ## path to automatic README.html utility
156 our $git_automatic_readme_html = $Girocco::Config::basedir . '/bin/run-format-readme.sh';
158 ## absolute fs-path which will be prepended to the project path
159 our $projectroot = $Girocco::Config::reporoot;
161 # source of projects list
162 our $projects_list = $Girocco::Config::projlist_cache_dir."/gitweb.list";
164 ## target of the home link on top of all pages (absolute url)
165 our $home_link = url_path($Girocco::Config::gitweburl,1);
167 ## string of the home link on top of all pages
168 our $home_link_str = $Girocco::Config::name;
170 ## name of your site or organization to appear in page titles
171 ## replace this with something more descriptive for clearer bookmarks
172 our $site_name = $Girocco::Config::title;
174 ## html text to include at home page
175 our $home_text = "$Girocco::Config::basedir/gitweb/indextext.html";
177 ## read-only version of text, but only when in read-only mode and this exists
178 ## note that when running in a fastcgi mode, changes to read-only mode will
179 ## not show up with regards to this text until the next fastcgi instance
180 ## spawns -- use a "graceful" web server restart to force an immediate effect
181 our $home_text_ro = "$Girocco::Config::basedir/gitweb/indextext_readonly.html";
183 ## URI of stylesheets
184 our @stylesheets = ("@{[url_path($Girocco::Config::gitwebfiles)]}/gitweb.css");
186 ## URI of GIT logo (72x27 size)
187 our $logo = "@{[url_path($Girocco::Config::gitwebfiles)]}/git-logo.png";
189 ## URI of GIT favicon, assumed to be image/png type
190 our $favicon = "@{[url_path($Girocco::Config::gitwebfiles)]}/git-favicon.png";
192 ## URI of gitweb.js
193 our $javascript = "@{[url_path($Girocco::Config::gitwebfiles)]}/gitweb.js";
195 ## URL Hints
197 ## Any of the urls in @git_base_url_list, @git_base_mirror_urls or
198 ## @git_base_push_urls may be an array ref instead of a scalar in which
199 ## case ${}[0] is the url and ${}[1] is an html fragment "hint" to display
200 ## right after the URL.
202 ## list of git base URLs used for URL for where to fetch project from,
203 ## i.e. full URL is "$git_base_url/$project"
204 our @git_base_url_list = ();
205 $Girocco::Config::gitpullurl and push @git_base_url_list, $Girocco::Config::gitpullurl;
206 $Girocco::Config::httppullurl and push @git_base_url_list, $Girocco::Config::httppullurl;
208 ## For push projects (a .nofetch file exists OR gitweb.showpush is true)
209 ## @git_base_url_list entries are shown as "mirror URL" and @git_base_push_urls
210 ## are shown as "push URL" and @git_base_mirror_urls are ignored.
211 ## For non-push projects, @git_base_url_list and @git_base_mirror_urls are shown
212 ## as "mirror URL" and @git_base_push_urls are ignored.
214 ## list of extra git base URLs used for mirrors for where to fetch project from,
215 ## i.e. full URL is "$git_base_mirror_url/$project"
216 our @git_base_mirror_urls = ();
217 $Girocco::Config::httpspushurl && $Girocco::Config::httpspushurl ne ($Girocco::Config::httppullurl||'') and
218 push @git_base_mirror_urls, [$Girocco::Config::httpspushurl,
219 "<sup class=\"sup\"><span><a href=\"@{[url_path($Girocco::Config::htmlurl)]}/rootcert.html\">(learn&#160;more)</a></span></sup>"];
220 $Girocco::Config::pushurl && $Girocco::Config::pushurl =~ m|^ssh://|i and
221 push @git_base_mirror_urls, substr($Girocco::Config::pushurl, 0, 6) .
222 'git@' . substr($Girocco::Config::pushurl, 6);
224 ## list of git base URLs used for URL to push project to,
225 ## i.e. full URL is "$git_base_push_url/$project"
226 our @git_base_push_urls = ();
227 $Girocco::Config::pushurl and push @git_base_push_urls, $Girocco::Config::pushurl;
228 $Girocco::Config::httpspushurl and push @git_base_push_urls, $Girocco::Config::httpspushurl;
230 our $cache_grpshared = 1;
231 our $cache_dir = $Girocco::Config::projlist_cache_dir;
233 our $lastactivity_file = "info/lastactivity";
235 $html_cache_actions{'summary'} = 1;
237 our $per_request_config = 0;
239 our $auto_fcgi = 1;
241 $feature{'pathinfo'}{'default'}=[1];
243 $feature{'forks'}{'default'}=[1];
245 $feature{'actions'}{'default'}=[
246 ('graphiclog1', "@{[url_path($Girocco::Config::gitwebfiles)]}/git-browser/by-commit.html?r=%n", 'log'),
247 ('graphiclog2', "@{[url_path($Girocco::Config::gitwebfiles)]}/git-browser/by-date.html?r=%n", 'graphiclog1'),
248 ('edit', "@{[url_path($Girocco::Config::webadmurl)]}/editproj.cgi?name=%e", 'refs'),
249 ('fork', "@{[url_path($Girocco::Config::webadmurl)]}/regproj.cgi?fork=%e", 'edit')
252 # Prevent any fast CGI instance from holding on to a possibly now-invalid
253 # current working directory. The "root" directory will always be valid (or you
254 # have bigger problems) even if it's the "root" of a chroot or other kind of
255 # jail. gitweb.cgi does not need or require any particular cwd to function and
256 # as all "use"s and "require"s that may depend on the current working directory
257 # have already been completed by now it's safe to "cd /" at this point.
258 chdir "/";
260 # If in read-only mode and $home_text_ro exists, set $home_text to it
261 defined($home_text_ro) && $home_text_ro ne "" && is_readonly() && -f $home_text_ro and
262 $home_text = $home_text_ro;
264 # Stuff extra Git configuration options into GIT_CONFIG_PARAMETERS
265 # This mirrors what shlib.sh does (mostly)
266 # Only the options that are appropriate for gitweb are included here
267 git_add_config("core.ignoreCase", "false");
268 git_add_config("core.pager", "cat");
269 # see comments in shlib.sh about packedGitWindowSize
270 if ($Girocco::Config::git_no_mmap) {
271 git_add_config("core.packedGitWindowSize", "1m");
272 } else {
273 git_add_config("core.packedGitWindowSize", "32m");
275 git_add_config("core.packedGitLimit", "256m");
276 # We explicitly set core.bigFileThreshold to only 16m as the
277 # actual value is computed and is not available here and should
278 # only affect pack generation. Since gitweb SHOULD NOT be doing
279 # anything that would generate any packs, this value should not
280 # matter. We set it anyway, just in case.
281 git_add_config("core.bigFileThreshold", "16m");
282 git_add_config("gc.auto", "0");
284 # Since we actually want to display "replaced" commits in
285 # gitweb just the same as git-browser does, make sure that
286 # GIT_NO_REPLACE_OBJECTS is NOT set in the environment for gitweb.
287 delete $ENV{'GIT_NO_REPLACE_OBJECTS'};
289 # This should not be needed, but just in case, make the last expression true