aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mars-attacks.org>2013-06-23 20:32:53 +0200
committerNicolas Vigier <boklm@mars-attacks.org>2013-06-23 20:32:53 +0200
commitb6d03855ca73e7346aadfb5138255742d038f17b (patch)
tree657b6edc1c91900a911f3d208d47736e0ff8ae93 /lib
parentc781ddb2f56d944347c2eb5f76256bcc0acae4dd (diff)
downloadmgagit-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.pm18
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;