We'll be using this sub to fill $GIT_DIR/objects/info/alternates
if somebody uses clone --mirror, too
$self->{-inbox}->git->cleanup;
}
$self->{-inbox}->git->cleanup;
}
+sub fill_alternates ($$) {
- my $pfx = "$self->{-inbox}->{mainrepo}/git";
- my $git_dir = "$pfx/$epoch.git";
- my @cmd = (qw(git init --bare -q), $git_dir);
- PublicInbox::Import::run_die(\@cmd);
+ my $pfx = "$self->{-inbox}->{mainrepo}/git";
my $all = "$self->{-inbox}->{mainrepo}/all.git";
my $all = "$self->{-inbox}->{mainrepo}/all.git";
unless (-d $all) {
@cmd = (qw(git init --bare -q), $all);
PublicInbox::Import::run_die(\@cmd);
unless (-d $all) {
@cmd = (qw(git init --bare -q), $all);
PublicInbox::Import::run_die(\@cmd);
'repack.writeBitmaps', 'true');
PublicInbox::Import::run_die(\@cmd);
}
'repack.writeBitmaps', 'true');
PublicInbox::Import::run_die(\@cmd);
}
-
- @cmd = (qw/git config/, "--file=$git_dir/config",
+ @cmd = (qw/git config/, "--file=$pfx/$epoch.git/config",
'include.path', '../../all.git/config');
PublicInbox::Import::run_die(\@cmd);
'include.path', '../../all.git/config');
PublicInbox::Import::run_die(\@cmd);
my $dir = "../../git/$i.git/objects";
push @add, $dir if !$alts{$dir} && -d "$pfx/$i.git";
}
my $dir = "../../git/$i.git/objects";
push @add, $dir if !$alts{$dir} && -d "$pfx/$i.git";
}
- return $git_dir unless @add;
open my $fh, '>>', $alt or die "open >> $alt: $!\n";
foreach my $dir (@add) {
print $fh "$dir\n" or die "print >> $alt: $!\n";
}
close $fh or die "close $alt: $!\n";
open my $fh, '>>', $alt or die "open >> $alt: $!\n";
foreach my $dir (@add) {
print $fh "$dir\n" or die "print >> $alt: $!\n";
}
close $fh or die "close $alt: $!\n";
+}
+
+sub git_init {
+ my ($self, $epoch) = @_;
+ my $git_dir = "$self->{-inbox}->{mainrepo}/git/$epoch.git";
+ my @cmd = (qw(git init --bare -q), $git_dir);
+ PublicInbox::Import::run_die(\@cmd);
+ fill_alternates($self, $epoch);