aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2017-01-14 11:58:46 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2017-01-14 11:58:46 +0530
commit996d11865f8b2dc1f84787753610c77428e75643 (patch)
tree8a7d4b67de2391f12084a11407aae98c98ee8e8f
parentfix shebang in repo-specific-hooks (diff)
downloadgitolite-gentoo-996d11865f8b2dc1f84787753610c77428e75643.tar.gz
gitolite-gentoo-996d11865f8b2dc1f84787753610c77428e75643.tar.bz2
gitolite-gentoo-996d11865f8b2dc1f84787753610c77428e75643.zip
allow @group names in config values to be expanded...
The string "@group" is replaced with a space separated list of member names if it is a valid group. Otherwise it is left alone.
-rwxr-xr-xsrc/triggers/post-compile/update-git-configs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/triggers/post-compile/update-git-configs b/src/triggers/post-compile/update-git-configs
index a58a85d..bdb83ac 100755
--- a/src/triggers/post-compile/update-git-configs
+++ b/src/triggers/post-compile/update-git-configs
@@ -48,6 +48,7 @@ sub fixup_config {
my $gc = git_config( $pr, '.', 1 );
while ( my ( $key, $value ) = each( %{$gc} ) ) {
next if $key =~ /^gitolite-options\./;
+ $value =~ s/(@\w+)/expand_group($1)/ge if $rc{EXPAND_GROUPS_IN_CONFIG};
if ( $value ne "" ) {
system( "git", "config", "--file", "$RB/$pr.git/config", $key, $value );
} else {
@@ -55,3 +56,10 @@ sub fixup_config {
}
}
}
+
+sub expand_group {
+ my $g = shift;
+ my @m = @{ Gitolite::Conf::Load::list_members($1) };
+ return join(" ", @m) if @m;
+ return $g;
+}