various: add read-only mode support
[girocco.git] / gitweb / gitbrowser_config.perl
blob961c4b8aa6701f40d95ff73104f47127801a9ba2
1 ## For the complete overview of available configuration options,
2 ## see git-browser.git/git-browser.cgi file right after "package inner" line
4 # Pull Girocco config
5 use lib "__BASEDIR__";
6 use Girocco::Config;
8 # If $check_path is set to a subroutine reference, it will be called
9 # by get_repo_path with two arguments, the name of the repo and its
10 # path which will be undef if it's not a known repo. If the function
11 # returns false, access to the repo will be denied.
12 # $check_path = sub { my ($name, $path) = @_; $name ~! /restricted/i; };
13 our $check_path = sub {
14 my ($name, $path) = @_;
15 if (not defined $path and
16 $name =~ m!^/*_! ||
17 $name =~ m!\.\.! ||
18 !($name =~ m!\.git/*$!) ||
19 $name =~ m!\.git/.*\.git/*$!i) {
20 return undef;
22 return 1;
25 # Since we actually want to display "replaced" commits in
26 # git-browser just the same as gitweb does, make sure that
27 # GIT_NO_REPLACE_OBJECTS is NOT set in the environment for git-browser.
28 delete $ENV{'GIT_NO_REPLACE_OBJECTS'};
30 # This should not be needed, but just in case, make the last expression true