Add special %GL_CREATOR variable for git-config
Add a special variable `%GL_CREATOR` to the the git-config trigger that is replaced by the name of the repository creator (if any). This can be useful to set up the default owner configuration for wild repositories. Example: repo assignments/CREATOR/a[0-9][0-9] C = @students RW+ = CREATOR config gitweb.owner = %GL_CREATOR ---- committer added an if condition to the s/// line.
This commit is contained in:
parent
f4eb6dcb53
commit
57bea39a1e
|
@ -43,12 +43,14 @@ for my $pr (@$lpr) {
|
||||||
|
|
||||||
sub fixup_config {
|
sub fixup_config {
|
||||||
my $pr = shift;
|
my $pr = shift;
|
||||||
|
my $creator = creator($pr);
|
||||||
|
|
||||||
my $gc = git_config( $pr, '.', 1 );
|
my $gc = git_config( $pr, '.', 1 );
|
||||||
while ( my ( $key, $value ) = each( %{$gc} ) ) {
|
while ( my ( $key, $value ) = each( %{$gc} ) ) {
|
||||||
next if $key =~ /^gitolite-options\./;
|
next if $key =~ /^gitolite-options\./;
|
||||||
if ( $value ne "" ) {
|
if ( $value ne "" ) {
|
||||||
$value =~ s/%GL_REPO/$pr/g;
|
$value =~ s/%GL_REPO/$pr/g;
|
||||||
|
$value =~ s/%GL_CREATOR/$creator/g if $creator;
|
||||||
system( "git", "config", "--file", "$RB/$pr.git/config", $key, $value );
|
system( "git", "config", "--file", "$RB/$pr.git/config", $key, $value );
|
||||||
} else {
|
} else {
|
||||||
system( "git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key );
|
system( "git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key );
|
||||||
|
|
Loading…
Reference in a new issue