-# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
# git fast-import-based ssoma-mda MDA replacement
"$ts $zone";
}
-sub extract_cmt_info ($) {
- my ($mime) = @_;
+sub extract_cmt_info ($;$) {
+ my ($mime, $smsg) = @_;
my $sender = '';
my $from = $mime->header('From');
}
}
if (defined $email) {
+ # Email::Address::XS may leave quoted '<' in addresses,
+ # which git-fast-import doesn't like
+ $email =~ tr/<>//d;
+
# quiet down wide character warnings with utf8::encode
utf8::encode($email);
} else {
utf8::encode($subject);
my $at = git_timestamp(my @at = msg_datestamp($hdr));
my $ct = git_timestamp(my @ct = msg_timestamp($hdr));
+ if ($smsg) {
+ $smsg->{ds} = $at[0];
+ $smsg->{ts} = $ct[0];
+ }
($name, $email, $at, $ct, $subject);
}
# returns undef on duplicate
# returns the :MARK of the most recent commit
sub add {
- my ($self, $mime, $check_cb) = @_; # mime = Email::MIME
+ my ($self, $mime, $check_cb, $smsg) = @_; # mime = Email::MIME
- my ($name, $email, $at, $ct, $subject) = extract_cmt_info($mime);
+ my ($name, $email, $at, $ct, $subject) = extract_cmt_info($mime, $smsg);
my $path_type = $self->{path_type};
my $path;
if ($path_type eq '2/38') {
print $w $raw_email, "\n" or wfail;
# v2: we need this for Xapian
- if ($self->{want_object_info}) {
- my $oid = $self->get_mark(":$blob");
- $self->{last_object} = [ $oid, $n, \$raw_email ];
+ if ($smsg) {
+ $smsg->{blob} = $self->get_mark(":$blob");
+ $smsg->{bytes} = $n;
+ $smsg->{-raw_email} = \$raw_email;
}
my $ref = $self->{ref};
my $commit = $self->{mark}++;