lib/PublicInbox/V2Writable.pm | 11 +++++------ diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 04c91e5dd3b77b44db3f974357e49aad4f538901..c896dc0ed7c80e7327e87aea3fece1d2a5b1bb7c 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -682,10 +682,7 @@ my ($self, $epoch) = @_; my $pfx = "$self->{-inbox}->{inboxdir}/git"; my $all = "$self->{-inbox}->{inboxdir}/all.git"; - - unless (-d $all) { - PublicInbox::Import::init_bare($all); - } + PublicInbox::Import::init_bare($all) unless -d $all; my $info_dir = "$all/objects/info"; my $alt = "$info_dir/alternates"; my (%alt, $new); @@ -695,7 +692,9 @@ open(my $fh, '<', $alt) or die "open < $alt: $!\n"; $mode = (stat($fh))[2] & 07777; # we assign a sort score to every alternate and favor - # the newest (highest numbered) one when we + # the newest (highest numbered) one because loose objects + # require scanning epochs and only the latest epoch is + # expected to see loose objects my $score; my $other = 0; # in case admin adds non-epoch repos %alt = map {; @@ -1213,7 +1212,6 @@ my $git_dir = git_dir_n($self, $i); die 'BUG: already reindexing!' if $self->{reindex_pipe}; -d $git_dir or return; # missing epochs are fine - fill_alternates($self, $i); my $git = PublicInbox::Git->new($git_dir); if (my $unindex_range = delete $sync->{unindex_range}->{$i}) { unindex($self, $sync, $git, $unindex_range); @@ -1247,6 +1245,7 @@ my $epoch_max; my $latest = git_dir_latest($self, \$epoch_max); return unless defined $latest; $self->idx_init($opt); # acquire lock + fill_alternates($self, $epoch_max); $self->{over}->rethread_prepare($opt); my $sync = { unindex_range => {}, # EPOCH => oid_old..oid_new