about summary refs log tree commit homepage
path: root/lib/PublicInbox/Mbox.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-20 00:57:16 +0000
committerEric Wong <e@80x24.org>2016-06-20 00:57:38 +0000
commit4b313dc74bc9bb84a542b7ec920cdb92879e7523 (patch)
treebdea400b15979d0d4206aa8aa840c71ed956eaca /lib/PublicInbox/Mbox.pm
parent2724361ab69cd071c970c66e076784c582c76e42 (diff)
downloadpublic-inbox-4b313dc74bc9bb84a542b7ec920cdb92879e7523.tar.gz
Favor Inbox objects as our primary source of truth to simplify
our code.  This increases our coupling with PSGI to make it
easier to write tests in the future.

A lot of this code was originally designed to be usable
standalone without PSGI or CGI at all; but that might increase
development effort.
Diffstat (limited to 'lib/PublicInbox/Mbox.pm')
-rw-r--r--lib/PublicInbox/Mbox.pm10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index 0258d8c7..63ec605f 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -107,7 +107,6 @@ EOF
 package PublicInbox::MboxGz;
 use strict;
 use warnings;
-use PublicInbox::MID qw(mid2path);
 
 sub new {
         my ($class, $ctx, $cb) = @_;
@@ -135,15 +134,12 @@ sub getline {
         my ($self) = @_;
         my $res;
         my $ctx = $self->{ctx};
-        my $git = $ctx->{git};
+        my $ibx = $ctx->{-inbox};
         my $gz = $self->{gz};
         do {
                 while (defined(my $smsg = shift @{$self->{msgs}})) {
-                        my $msg = eval {
-                                my $p = 'HEAD:'.mid2path($smsg->mid);
-                                Email::Simple->new($git->cat_file($p));
-                        };
-                        $msg or next;
+                        my $msg = eval { $ibx->msg_by_mid($smsg->mid) } or next;
+                        $msg = Email::Simple->new($msg);
                         $gz->write(PublicInbox::Mbox::msg_str($ctx, $msg));
                         my $ret = _flush_buf($self);
                         return $ret if $ret;