From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Cc: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
Subject: [PATCH 01/14] www: remove unnecessary ghost checks
Date: Thu, 29 Mar 2018 10:28:06 +0000 [thread overview]
Message-ID: <20180329102819.15234-2-e@80x24.org> (raw)
In-Reply-To: <20180329102819.15234-1-e@80x24.org>
We do not need to care about ghosts at multiple call sites; they
cannot have a {blob} field and we've stored the blob field in
Xapian since SCHEMA_VERSION=13.
---
lib/PublicInbox/Inbox.pm | 10 ++++------
lib/PublicInbox/Mbox.pm | 2 --
lib/PublicInbox/View.pm | 2 --
3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 3097751..47b8630 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -270,12 +270,10 @@ sub msg_by_path ($$;$) {
sub msg_by_smsg ($$;$) {
my ($self, $smsg, $ref) = @_;
- return unless defined $smsg; # ghost
-
- # backwards compat to fallback to msg_by_mid
- # TODO: remove if we bump SCHEMA_VERSION in Search.pm:
- defined(my $blob = $smsg->{blob}) or
- return msg_by_path($self, mid2path($smsg->mid), $ref);
+ # ghosts may have undef smsg (from SearchThread.node) or
+ # no {blob} field (from each_smsg_by_mid)
+ return unless defined $smsg;
+ defined(my $blob = $smsg->{blob}) or return;
my $str = git($self)->cat_file($blob, $ref);
$$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s if $str;
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index c14037f..381bcad 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -41,7 +41,6 @@ sub getline {
}
for (; !defined($cur) && $head != $tail; $head++) {
my $smsg = PublicInbox::SearchMsg->get($head, $db, $ctx->{mid});
- next if $smsg->type ne 'mail';
my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next;
$cur = Email::Simple->new($mref);
$cur = msg_str($ctx, $cur);
@@ -66,7 +65,6 @@ sub emit_raw {
for (; !defined($first) && $head != $tail; $head++) {
my @args = ($head, $db, $mid);
my $smsg = PublicInbox::SearchMsg->get(@args);
- next if $smsg->type ne 'mail';
my $mref = $ibx->msg_by_smsg($smsg) or next;
$first = Email::Simple->new($mref);
}
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 5fb2b31..133c30a 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -63,7 +63,6 @@ sub msg_page {
for (; !defined($first) && $head != $tail; $head++) {
my @args = ($head, $db, $mid);
my $smsg = PublicInbox::SearchMsg->get(@args);
- next if $smsg->type ne 'mail';
$first = $ibx->msg_by_smsg($smsg);
}
if ($head != $tail) {
@@ -85,7 +84,6 @@ sub msg_html_more {
my $mid = $ctx->{mid};
for (; !defined($smsg) && $head != $tail; $head++) {
my $m = PublicInbox::SearchMsg->get($head, $db, $mid);
- next if $m->type ne 'mail';
$smsg = $ctx->{-inbox}->smsg_mime($m);
}
if ($head == $tail) { # done
--
EW
next prev parent reply other threads:[~2018-03-29 10:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 10:28 [PATCH 00/14] purging support, v1 conversions, cleanups + more Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` Eric Wong (Contractor, The Linux Foundation) [this message]
2018-03-29 10:28 ` [PATCH 02/14] v2writable: append, instead of prepending generated Message-ID Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 03/14] lookup by Message-ID favors the "primary" one Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 04/14] www: fix attachment downloads for conflicted Message-IDs Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 05/14] searchmsg: document why we store To: and Cc: for NNTP Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 06/14] public-inbox-convert: tool for converting old to new inboxes Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 07/14] v2writable: support purging messages from git entirely Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 08/14] search: cleanup uniqueness checking Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 09/14] search: get rid of most lookup_* subroutines Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 10/14] search: move find_doc_ids to searchidx Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 11/14] v2writable: cleanup: get rid of unused fields Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 12/14] mbox: avoid extracting Message-ID for linkification Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 13/14] www: cleanup expensive fallback for legacy URLs Eric Wong (Contractor, The Linux Foundation)
2018-03-29 10:28 ` [PATCH 14/14] view: get rid of some unnecessary imports Eric Wong (Contractor, The Linux Foundation)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180329102819.15234-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).