about summary refs log tree commit homepage
path: root/lib/PublicInbox/V2Writable.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-18 09:13:13 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-18 09:14:17 +0000
commit017fed7bc4d33ac474a19356994be5bd0bfe68ba (patch)
treedd1fe9a007eed3506532f88875e4bf455a5e3404 /lib/PublicInbox/V2Writable.pm
parent0bf744b91df2d40580ff5776311d57dcede850b0 (diff)
downloadpublic-inbox-017fed7bc4d33ac474a19356994be5bd0bfe68ba.tar.gz
Some messages to git@vger went missing from Msgmap from old bugs
and became inaccessible via NNTP.  Forcing NNTP article numbers
when the overview DB came about made the problem more visible when
reindexing old (v1) repositories as all removed spam messages
took up AUTOINCREMENT numbers again before they were removed.

Having large gaps in NNTP article numbers is not good since it
throws off NNTP clients.  This does NOT prevent NNTP clients from
seeing some messages twice, but is better than having them
miss several messages entirely.

We also avoid depending on --reverse in git-log, as
git requires storing an entire commit list in memory for
--reverse, so it's cheaper to store only deleted blobs in the %D
hash since they do not live long.
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r--lib/PublicInbox/V2Writable.pm15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index e9fd502e..2cc87305 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -15,7 +15,8 @@ use PublicInbox::ContentId qw(content_id content_digest);
 use PublicInbox::Inbox;
 use PublicInbox::OverIdx;
 use PublicInbox::Msgmap;
-use PublicInbox::Spawn;
+use PublicInbox::Spawn qw(spawn);
+use PublicInbox::SearchIdx;
 use IO::Handle;
 
 # an estimate of the post-packed size to the raw uncompressed size
@@ -561,7 +562,6 @@ sub import_init {
 sub diff ($$$) {
         my ($mid, $cur, $new) = @_;
         use File::Temp qw(tempfile);
-        use PublicInbox::Spawn qw(spawn);
 
         my ($ah, $an) = tempfile('email-cur-XXXXXXXX', TMPDIR => 1);
         print $ah $cur->as_string or die "print: $!";
@@ -738,16 +738,7 @@ sub last_commits {
         $heads;
 }
 
-sub is_ancestor ($$$) {
-        my ($git, $cur, $tip) = @_;
-        return 0 unless $git->check($cur);
-        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;
-}
+*is_ancestor = *PublicInbox::SearchIdx::is_ancestor;
 
 sub index_prepare {
         my ($self, $opts, $epoch_max, $ranges) = @_;