Skip to content

Commit

Permalink
allow @group names in config values to be expanded...
Browse files Browse the repository at this point in the history
The string "@group" is replaced with a space separated list of member
names if it is a valid group.  Otherwise it is left alone.
  • Loading branch information
sitaramc committed Jan 14, 2017
1 parent 72c0238 commit 996d118
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/triggers/post-compile/update-git-configs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ 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 {
system( "git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key );
}
}
}

sub expand_group {
my $g = shift;
my @m = @{ Gitolite::Conf::Load::list_members($1) };
return join(" ", @m) if @m;
return $g;
}

0 comments on commit 996d118

Please sign in to comment.