aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/MGA/Git.pm18
-rwxr-xr-xmgagit1
2 files changed, 14 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;
diff --git a/mgagit b/mgagit
index 3d94524..1149ca2 100755
--- a/mgagit
+++ b/mgagit
@@ -74,6 +74,7 @@ sub glrun {
MGA::Git::load_users(\%r);
MGA::Git::update_gitolite_keydir(\%r);
MGA::Git::update_gitolite_config(\%r);
+ MGA::Git::run_gitolite(\%r);
}
if (@ARGV == 0 || !$actions{$ARGV[0]}) {