diff options
author | Nicolas Vigier <boklm@mars-attacks.org> | 2013-06-23 20:32:53 +0200 |
---|---|---|
committer | Nicolas Vigier <boklm@mars-attacks.org> | 2013-06-23 20:32:53 +0200 |
commit | b6d03855ca73e7346aadfb5138255742d038f17b (patch) | |
tree | 657b6edc1c91900a911f3d208d47736e0ff8ae93 /lib | |
parent | c781ddb2f56d944347c2eb5f76256bcc0acae4dd (diff) | |
download | mgagit-b6d03855ca73e7346aadfb5138255742d038f17b.tar mgagit-b6d03855ca73e7346aadfb5138255742d038f17b.tar.gz mgagit-b6d03855ca73e7346aadfb5138255742d038f17b.tar.bz2 mgagit-b6d03855ca73e7346aadfb5138255742d038f17b.tar.xz mgagit-b6d03855ca73e7346aadfb5138255742d038f17b.zip |
Run gitolite if conf or keydir changed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MGA/Git.pm | 18 |
1 files changed, 13 insertions, 5 deletions
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; |