]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/V2Writable.pm
wwwstream: always show multi-line cloning instructions
[public-inbox.git] / lib / PublicInbox / V2Writable.pm
index 92d2672c78c478f886a3bd7d5f9cb8c238f3456b..152d90ab3ea595fd56c8b7643831fd28fbecbdbb 100644 (file)
@@ -83,11 +83,14 @@ sub new {
 }
 
 sub init_inbox {
-       my ($self, $parallel) = @_;
+       my ($self, $parallel, $skip) = @_;
        $self->{parallel} = $parallel;
        $self->idx_init;
        my $epoch_max = -1;
        git_dir_latest($self, \$epoch_max);
+       if (defined $skip && $epoch_max == -1) {
+               $epoch_max = $skip;
+       }
        $self->git_init($epoch_max >= 0 ? $epoch_max : 0);
        $self->done;
 }
@@ -676,6 +679,7 @@ sub reindex_oid {
                if (defined $n && $n > $num) {
                        $mid0 = $mid;
                        $num = $n;
+                       $self->{mm}->mid_set($num, $mid0);
                }
        }
        if (!defined($mid0) && $regen && !$del) {
@@ -841,7 +845,10 @@ sub unindex_oid {
                        warn "BUG: multiple articles linked to $oid\n",
                                join(',',sort keys %gone), "\n";
                }
-               $self->{unindexed}->{$_}++ foreach keys %gone;
+               foreach my $num (keys %gone) {
+                       $self->{unindexed}->{$_}++;
+                       $self->{mm}->num_delete($num);
+               }
                $self->unindex_oid_remote($oid, $mid);
        }
 }