update hook/conf: $PERSONAL branch prefix

wicked cool to get it in one line of code!
This commit is contained in:
Sitaram Chamarty 2009-08-30 13:42:53 +05:30
parent abb4580d85
commit dd13de2d14
2 changed files with 12 additions and 0 deletions

View file

@ -33,6 +33,16 @@ $GL_CONF="$GL_ADMINDIR/conf/gitolite.conf";
$GL_KEYDIR="$GL_ADMINDIR/keydir"; $GL_KEYDIR="$GL_ADMINDIR/keydir";
$GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm"; $GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm";
# --------------------------------------
# personal branch prefix; leave it as is (empty) if you don't want to use the
# feature (see the "developer-specific branches" section in the "faq, tips,
# etc" document)
$PERSONAL="";
# uncomment one of these if you do want it. I recommend this:
# $PERSONAL="refs/personal";
# but if you want something more visible/noisy, use this:
# $PERSONAL="refs/heads/personal";
# -------------------------------------- # --------------------------------------
# per perl rules, this should be the last line in such a file: # per perl rules, this should be the last line in such a file:
1; 1;

View file

@ -27,6 +27,7 @@ use warnings;
our $GL_ADMINDIR; our $GL_ADMINDIR;
our $GL_CONF_COMPILED; our $GL_CONF_COMPILED;
our $PERSONAL;
our %repos; our %repos;
my $glrc = $ENV{HOME} . "/.gitolite.rc"; my $glrc = $ENV{HOME} . "/.gitolite.rc";
@ -67,6 +68,7 @@ $perm = '+' if $oldsha ne $merge_base;
my @allowed_refs; my @allowed_refs;
push @allowed_refs, @ { $repos{$ENV{GL_REPO}}{$perm}{$ENV{GL_USER}} || [] }; push @allowed_refs, @ { $repos{$ENV{GL_REPO}}{$perm}{$ENV{GL_USER}} || [] };
push @allowed_refs, @ { $repos{$ENV{GL_REPO}}{$perm}{'@all'} || [] }; push @allowed_refs, @ { $repos{$ENV{GL_REPO}}{$perm}{'@all'} || [] };
push @allowed_refs, "$PERSONAL/$ENV{GL_USER}-" if $PERSONAL;
for my $refex (@allowed_refs) for my $refex (@allowed_refs)
# refex? sure -- a regex to match a ref against :) # refex? sure -- a regex to match a ref against :)
{ {