X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FImport.pm;h=68dc0c7e83c1b223796ee171200d879065e1add2;hb=03255d56a53d390a7f7bb069e0f1c6ea5d34756c;hp=6ac43d372d38d2e99d55bfb101f80e00c56333b6;hpb=9f5a583694396f84056b9d92255bba0197b52bc8;p=public-inbox.git diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 6ac43d37..68dc0c7e 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2019 all contributors +# Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ # # git fast-import-based ssoma-mda MDA replacement @@ -9,7 +9,7 @@ package PublicInbox::Import; use strict; use warnings; use base qw(PublicInbox::Lock); -use PublicInbox::Spawn qw(spawn); +use PublicInbox::Spawn qw(spawn popen_rd); use PublicInbox::MID qw(mids mid2path); use PublicInbox::Address; use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp); @@ -46,8 +46,7 @@ sub gfi_start { return ($self->{in}, $self->{out}) if $self->{pid}; - my ($in_r, $in_w, $out_r, $out_w); - pipe($in_r, $in_w) or die "pipe failed: $!"; + my ($out_r, $out_w); pipe($out_r, $out_w) or die "pipe failed: $!"; my $git = $self->{git}; @@ -66,8 +65,7 @@ sub gfi_start { my $git_dir = $git->{git_dir}; my @cmd = ('git', "--git-dir=$git_dir", qw(fast-import --quiet --done --date-format=raw)); - my $rdr = { 0 => $out_r, 1 => $in_w }; - my $pid = spawn(\@cmd, undef, $rdr); + my ($in_r, $pid) = popen_rd(\@cmd, undef, { 0 => $out_r }); $out_w->autoflush(1); $self->{in} = $in_r; $self->{out} = $out_w; @@ -295,6 +293,10 @@ sub extract_cmt_info ($) { } } 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 {