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.
redis
Patrick Westerhoff 2012-06-21 23:52:22 +02:00 committed by Sitaram Chamarty
parent f4eb6dcb53
commit 57bea39a1e
1 changed files with 2 additions and 0 deletions

View File

@ -43,12 +43,14 @@ for my $pr (@$lpr) {
sub fixup_config {
my $pr = shift;
my $creator = creator($pr);
my $gc = git_config( $pr, '.', 1 );
while ( my ( $key, $value ) = each( %{$gc} ) ) {
next if $key =~ /^gitolite-options\./;
if ( $value ne "" ) {
$value =~ s/%GL_REPO/$pr/g;
$value =~ s/%GL_CREATOR/$creator/g if $creator;
system( "git", "config", "--file", "$RB/$pr.git/config", $key, $value );
} else {
system( "git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key );