use warnings;
use PublicInbox::Git;
use PublicInbox::MID qw(mid2path);
-use PublicInbox::MIME;
+use PublicInbox::Eml;
# Long-running "git-cat-file --batch" processes won't notice
# unlinked packs, so we need to restart those processes occasionally.
sub _set_limiter ($$$) {
my ($self, $pi_config, $pfx) = @_;
my $lkey = "-${pfx}_limiter";
- $self->{$lkey} ||= eval {
+ $self->{$lkey} ||= do {
# full key is: publicinbox.$NAME.httpbackendmax
my $mkey = $pfx.'max';
my $val = $self->{$mkey} or return;
sub git_epoch {
my ($self, $epoch) = @_;
$self->version == 2 or return;
- $self->{"$epoch.git"} ||= eval {
+ $self->{"$epoch.git"} ||= do {
my $git_dir = "$self->{inboxdir}/git/$epoch.git";
my $g = PublicInbox::Git->new($git_dir);
$g->{-httpbackend_limiter} = $self->{-httpbackend_limiter};
sub git {
my ($self) = @_;
- $self->{git} ||= eval {
+ $self->{git} ||= do {
my $git_dir = $self->{inboxdir};
$git_dir .= '/all.git' if $self->version == 2;
my $g = PublicInbox::Git->new($git_dir);
# for v1 users w/o SQLite only
sub msg_by_path ($$;$) {
my ($self, $path, $ref) = @_;
- my $str = git($self)->cat_file('HEAD:'.$path, $ref);
- $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s if $str;
- $str;
+ git($self)->cat_file('HEAD:'.$path, $ref);
}
sub msg_by_smsg ($$;$) {
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;
- $str;
+ git($self)->cat_file($blob, $ref);
}
sub smsg_mime {
my ($self, $smsg, $ref) = @_;
if (my $s = msg_by_smsg($self, $smsg, $ref)) {
- $smsg->{mime} = PublicInbox::MIME->new($s);
+ $smsg->{mime} = PublicInbox::Eml->new($s);
return $smsg;
}
}