From dd13de2d14bb11a51cc9424cd5eef8e7a3f4f6f3 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sun, 30 Aug 2009 13:42:53 +0530 Subject: [PATCH] update hook/conf: $PERSONAL branch prefix wicked cool to get it in one line of code! --- conf/example.gitolite.rc | 10 ++++++++++ src/update-hook.pl | 2 ++ 2 files changed, 12 insertions(+) diff --git a/conf/example.gitolite.rc b/conf/example.gitolite.rc index 72acc79..f63a411 100644 --- a/conf/example.gitolite.rc +++ b/conf/example.gitolite.rc @@ -33,6 +33,16 @@ $GL_CONF="$GL_ADMINDIR/conf/gitolite.conf"; $GL_KEYDIR="$GL_ADMINDIR/keydir"; $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: 1; diff --git a/src/update-hook.pl b/src/update-hook.pl index 834a32f..4a51d76 100755 --- a/src/update-hook.pl +++ b/src/update-hook.pl @@ -27,6 +27,7 @@ use warnings; our $GL_ADMINDIR; our $GL_CONF_COMPILED; +our $PERSONAL; our %repos; my $glrc = $ENV{HOME} . "/.gitolite.rc"; @@ -67,6 +68,7 @@ $perm = '+' if $oldsha ne $merge_base; my @allowed_refs; push @allowed_refs, @ { $repos{$ENV{GL_REPO}}{$perm}{$ENV{GL_USER}} || [] }; push @allowed_refs, @ { $repos{$ENV{GL_REPO}}{$perm}{'@all'} || [] }; +push @allowed_refs, "$PERSONAL/$ENV{GL_USER}-" if $PERSONAL; for my $refex (@allowed_refs) # refex? sure -- a regex to match a ref against :) {