1
package Gitolite::Conf;
3
# explode/parse a conf file
4
# ----------------------------------------------------------------------
12
use Exporter 'import';
17
use Gitolite::Conf::Sugar;
18
use Gitolite::Conf::Store;
23
# ----------------------------------------------------------------------
26
_die "'gitolite compile' does not take any arguments" if @_;
28
_chdir( $rc{GL_ADMIN_BASE} );
31
parse( sugar('gitolite.conf') );
33
# the order matters; new repos should be created first, to give store a
34
# place to put the individual gl-conf files
38
for my $repo ( @{ $rc{NEW_REPOS_CREATED} } ) {
39
trigger( 'POST_CREATE', $repo );
45
trace( 2, scalar(@$lines) . " lines incoming" );
47
for my $line (@$lines) {
49
if ( $line =~ /^(@\S+) = (.*)/ ) {
50
add_to_group( $1, split( ' ', $2 ) );
51
} elsif ( $line =~ /^repo (.*)/ ) {
52
set_repolist( split( ' ', $1 ) );
53
} elsif ( $line =~ /^(-|C|R|RW\+?(?:C?D?|D?C?)M?) (.* )?= (.+)/ ) {
55
my @refs = parse_refs( $2 || '' );
56
my @users = parse_users($3);
59
for my $user (@users) {
60
add_rule( $perm, $ref, $user );
63
} elsif ( $line =~ /^config (.+) = ?(.*)/ ) {
64
my ( $key, $value ) = ( $1, $2 );
65
$value =~ s/^['"](.*)["']$/$1/;
66
my @validkeys = split( ' ', ( $rc{GIT_CONFIG_KEYS} || '' ) );
67
push @validkeys, "gitolite-options\\..*";
68
my @matched = grep { $key =~ /^$_$/ } @validkeys;
69
_die "git config '$key' not allowed\ncheck GIT_CONFIG_KEYS in the rc file" if ( @matched < 1 );
70
_die "bad value '$value'" if $value =~ $UNSAFE_PATT;
71
add_config( 1, $key, $value );
72
} elsif ( $line =~ /^subconf (\S+)$/ ) {
76
_warn "syntax error, ignoring: '$line'";