aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/Gitolite/Triggers/Mirroring.pm24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/lib/Gitolite/Triggers/Mirroring.pm b/src/lib/Gitolite/Triggers/Mirroring.pm
index 07b7f96..dd33354 100644
--- a/src/lib/Gitolite/Triggers/Mirroring.pm
+++ b/src/lib/Gitolite/Triggers/Mirroring.pm
@@ -194,15 +194,16 @@ sub post_git {
sub copies {
my $repo = shift;
+ my %out;
my $ref = git_config( $repo, "^gitolite-options\\.mirror\\.copies.*" );
- my %out = map { $_ => 'async' } map { split } values %$ref;
+ map { $out{$_} = 'async' } map { split } values %$ref;
- $ref = git_config( $repo, "^gitolite-options\\.mirror\\.copies\\.sync.*" );
- map { $out{$_} = 'sync' } map { split } values %$ref;
-
- $ref = git_config( $repo, "^gitolite-options\\.mirror\\.copies\\.nosync.*" );
- map { $out{$_} = 'nosync' } map { split } values %$ref;
+ my @sync_types = qw(sync async nosync nosync-quiet);
+ foreach my $sync_type ( @sync_types ) {
+ $ref = git_config( $repo, "^gitolite-options\\.mirror\\.copies\\.${sync_type}.*" );
+ map { $out{$_} = $sync_type } map { split } values %$ref;
+ }
return %out;
}
@@ -237,9 +238,14 @@ sub push_to_copies {
my $lb = "$ENV{GL_REPO_BASE}/$repo.git/.gl-mirror-lock";
for my $s ( sort keys %copies ) {
trace( 1, "push_to_copies skipping self" ), next if $s eq $hn;
- system("gitolite 1plus1 $lb.$s gitolite mirror push $s $repo </dev/null >/dev/null 2>&1 &") if $copies{$s} eq 'async';
- system("gitolite 1plus1 $lb.$s gitolite mirror push $s $repo </dev/null >/dev/null 2>&1") if $copies{$s} eq 'sync';
- _warn "manual mirror push pending for '$s'" if $copies{$s} eq 'nosync';
+ my $mirror_command = "gitolite 1plus1 $lb.$s gitolite mirror push $s $repo </dev/null >/dev/null 2>&1";
+ switch($copies{$s}) {
+ case 'async' { system($mirror_command . " &"); }
+ case 'sync' { system($mirror_command); }
+ case 'nosync' { _warn "manual mirror push pending for '$s'"; }
+ case 'nosync-quiet' { 1; }
+ else { _warn "unknown mirror copy type $copies{$s} for '$s'"; }
+ }
}
$ENV{GL_USER} = $u;