blob: f5250829c6201406fc270dacd98464757ca4d515 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/perl
# Set alternates if option reference.repo is set
# ----------------------------------------------------------------------
use FindBin;
use lib $ENV{GL_LIBDIR};
use Gitolite::Rc;
use Gitolite::Common;
use Gitolite::Conf::Load;
use strict;
use warnings;
my $RB = $rc{GL_REPO_BASE};
if ( @ARGV and $ARGV[0] eq 'POST_CREATE' ) {
my $repo = $ARGV[1];
create_alternates($repo);
exit 0;
}
# not interested in any other triggers
exit 0;
sub create_alternates {
my $pr = shift;
my $refrepos = git_config( $pr, "^gitolite-options\\.reference\\.repo.*" );
my %list = map { $_ => 1 } map { split } values %$refrepos;
my @alts = keys %list;
if ( @alts ) {
my $altlist = join "\n", map { "$RB/$_.git/objects" } @alts;
_print( "$RB/$pr.git/objects/info/alternates", "$altlist\n" );
}
}
|