gitolite/src/triggers/post-compile/update-git-configs

35 lines
884 B
Plaintext
Raw Normal View History

2012-03-19 11:45:21 +01:00
#!/usr/bin/perl
# update git-config entries in each repo
# ----------------------------------------------------------------------
use FindBin;
use lib $ENV{GL_BINDIR};
use Gitolite::Rc;
use Gitolite::Common;
use Gitolite::Conf::Load;
use strict;
use warnings;
# ----------------------------------------------------------------------
my $RB = $rc{GL_REPO_BASE};
_chdir ($RB);
my $lpr = list_phy_repos();
for my $pr (@$lpr) {
my $gc = git_config($pr, '.');
while ( my ($key, $value) = each(%{ $gc }) ) {
next if $key =~ /^gitolite-options\./;
if ($value ne "") {
$value =~ s/^['"](.*)["']$/$1/;
$value =~ s/%GL_REPO/$pr/g;
system("git", "config", "--file", "$RB/$pr.git/config", $key, $value);
} else {
system("git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key);
}
}
}