about summary refs log tree commit homepage
path: root/lib/PublicInbox/ExtSearchIdx.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/ExtSearchIdx.pm')
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index ba7588d5..a08a9451 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -1192,7 +1192,7 @@ sub idx_init { # similar to V2Writable
         $self->git->cleanup;
         my $mode = 0644;
         my $ALL = $self->git->{git_dir}; # topdir/ALL.git
-        my ($has_new, $alt, $seen);
+        my ($has_new, $alt, $seen, $prune, $prune_nr);
         if ($opt->{-private}) { # LeiStore
                 my $local = "$self->{topdir}/local"; # lei/store
                 $self->{mg} //= PublicInbox::MultiGit->new($self->{topdir},
@@ -1208,8 +1208,8 @@ sub idx_init { # similar to V2Writable
         } else { # extindex has no epochs
                 $self->{mg} //= PublicInbox::MultiGit->new($self->{topdir},
                                                         'ALL.git');
-                ($alt, $seen) = $self->{mg}->read_alternates(\$mode,
-                                                        $opt->{-idx_gc});
+                $prune = $opt->{-idx_gc} ? \$prune_nr : undef;
+                ($alt, $seen) = $self->{mg}->read_alternates(\$mode, $prune);
                 PublicInbox::Import::init_bare($ALL);
         }
 
@@ -1243,7 +1243,7 @@ sub idx_init { # similar to V2Writable
                 }
                 $new .= "$d\n";
         }
-        ($has_new || $new ne '') and
+        ($has_new || $prune_nr || $new ne '') and
                 $self->{mg}->write_alternates($mode, $alt, $new);
         $git_midx and $self->with_umask(sub {
                 my @cmd = ('multi-pack-index');