-
- # reindex stops at the current heads and we later rerun index_sync
- # without {reindex}
- my $reindex_heads = $self->last_commits($epoch_max) if $sync->{reindex};
-
- for (my $i = $epoch_max; $i >= 0; $i--) {
- my $git_dir = $sync->{ibx}->git_dir_n($i);
+ my $pfx;
+ if ($pr) {
+ ($pfx) = ($sync->{ibx}->{inboxdir} =~ m!([^/]+)\z!g);
+ $pfx //= $sync->{ibx}->{inboxdir};
+ }
+
+ my $reindex_heads;
+ if ($self->{ibx_map}) {
+ # ExtSearchIdx won't index messages unless they're in
+ # over.sqlite3 for a given inbox, so don't read beyond
+ # what's in the per-inbox index.
+ $reindex_heads = [];
+ my $v = PublicInbox::Search::SCHEMA_VERSION;
+ my $mm = $sync->{ibx}->mm;
+ for my $i (0..$sync->{epoch_max}) {
+ $reindex_heads->[$i] = $mm->last_commit_xap($v, $i);
+ }
+ } elsif ($sync->{reindex}) { # V2 inbox
+ # reindex stops at the current heads and we later
+ # rerun index_sync without {reindex}
+ $reindex_heads = $self->last_commits($sync);
+ }
+ if ($sync->{max_size} = $sync->{-opt}->{max_size}) {
+ $sync->{index_oid} = $self->can('index_oid');
+ }
+ my $git_pfx = "$sync->{ibx}->{inboxdir}/git";
+ for (my $i = $sync->{epoch_max}; $i >= 0; $i--) {
+ my $git_dir = "$git_pfx/$i.git";