From b6d03855ca73e7346aadfb5138255742d038f17b Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Sun, 23 Jun 2013 20:32:53 +0200 Subject: Run gitolite if conf or keydir changed --- lib/MGA/Git.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/MGA/Git.pm b/lib/MGA/Git.pm index 378f00b..6f49833 100644 --- a/lib/MGA/Git.pm +++ b/lib/MGA/Git.pm @@ -174,12 +174,20 @@ sub update_gitolite_config { my $oldconf = -f $config->{gitolite_config} ? read_file($config->{gitolite_config}) : ''; my $newconf = gitolite_config($r); - if ($oldconf eq $newconf) { - print "Gitolite config didn't change\n"; - return; + if ($oldconf ne $newconf) { + write_file($config->{gitolite_config}, $newconf); + $r->{glconf_changed} = 1; + } +} + +sub run_gitolite { + my ($r) = @_; + if ($config->{run_gitolite} && $config->{run_gitolite} eq 'yes' + && ($r->{keydir_changed} || $r->{glconf_changed})) { + system('gitolite', 'compile'); + system('gitolite', 'setup', '--hooks-only'); + system('gitolite', 'trigger', 'POST_COMPILE'); } - write_file($config->{gitolite_config}, $newconf); - print "TODO: Run gitolite\n"; } 1; -- cgit v1.2.1