use base qw(PublicInbox::Search PublicInbox::Lock);
use PublicInbox::MIME;
use PublicInbox::InboxWritable;
-use PublicInbox::MID qw/mid_clean id_compress mid_mime mids_for_index/;
+use PublicInbox::MID qw/mid_clean mid_mime mids_for_index/;
use PublicInbox::MsgIter;
use Carp qw(croak);
use POSIX qw(strftime);
ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
my $levels = qr/\A(?:full|medium|basic)\z/;
my $inboxdir = $ibx->{inboxdir};
- my $version = $ibx->{version} || 1;
+ my $version = $ibx->version;
my $indexlevel = 'full';
my $altid = $ibx->{altid};
if ($altid) {
-inbox => $ibx,
git => $ibx->git,
-altid => $altid,
- version => $version,
+ ibx_ver => $version,
indexlevel => $indexlevel,
}, $class;
$ibx->umask_prepare;
index_diff_inc($self, $_, 'XDFCTX', $xnq);
} elsif (/^-- $/) { # email signature begins
$in_diff = undef;
- } elsif (m!^diff --git ("?a/.+) ("?b/.+)\z!) {
- my ($fa, $fb) = ($1, $2);
- my $fn = (split('/', git_unquote($fa), 2))[1];
- $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq);
- $fn = (split('/', git_unquote($fb), 2))[1];
- $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq);
+ } elsif (m!^diff --git "?[^/]+/.+ "?[^/]+/.+\z!) {
+ # wait until "---" and "+++" to capture filenames
$in_diff = 1;
# traditional diff:
} elsif (m/^diff -(.+) (\S+) (\S+)$/) {
next unless $opt =~ /[uU]/;
$in_diff = index_old_diff_fn($self, \%seen, $fa, $fb,
$xnq);
- } elsif (m!^--- ("?a/.+)!) {
+ } elsif (m!^--- ("?[^/]+/.+)!) {
my $fn = $1;
$fn = (split('/', git_unquote($fn), 2))[1];
$seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq);
$in_diff = 1;
- } elsif (m!^\+\+\+ ("?b/.+)!) {
+ } elsif (m!^\+\+\+ ("?[^/]+/.+)!) {
my $fn = $1;
$fn = (split('/', git_unquote($fn), 2))[1];
$seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq);
sub _msgmap_init ($) {
my ($self) = @_;
- die "BUG: _msgmap_init is only for v1\n" if $self->{version} != 1;
+ die "BUG: _msgmap_init is only for v1\n" if $self->{ibx_ver} != 1;
$self->{mm} //= eval {
require PublicInbox::Msgmap;
PublicInbox::Msgmap->new($self->{inboxdir}, 1);
batch_do($self, 'Q' . $mid, sub {
my ($ids) = @_;
$db->delete_document($_) for @$ids;
- $nr = scalar @$ids;
+ $nr += scalar @$ids;
});
};
if ($@) {
my $cmd = [ 'git', "--git-dir=$git->{git_dir}",
qw(merge-base --is-ancestor), $cur, $tip ];
my $pid = spawn($cmd);
- defined $pid or die "spawning ".join(' ', @$cmd)." failed: $!";
waitpid($pid, 0) == $pid or die join(' ', @$cmd) .' did not finish';
$? == 0;
}