gitolite/src/triggers/post-compile/update-git-configs
Sitaram Chamarty 07cf7fedfe move triggers into their own subdir...
...otherwise 'gitolite help' was getting too confusing, mixing up stuff
that users should not be running directly (even on the server)

----

implementation notes:

those who are worried about the '../triggers/' in various parts of the
code here, remember you can only do that from a command line on the
server.  Remote users can only use commands that have been explicitly
listed in the COMMANDS hash in the rc file.  This means they can't even
access other commands in the same directory as, say, the 'info' command,
so a '../' is definitely not going to work.
2012-03-26 11:02:57 +05:30

35 lines
884 B
Perl
Executable file

#!/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);
}
}
}