diff options
author | Eric Wong <e@80x24.org> | 2019-01-20 13:46:28 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-01-20 20:22:45 +0000 |
commit | 71883b865aa814445c9cf8160a25c3a5d474cb55 (patch) | |
tree | d72d7cf249681ccf4cacd9d96933e3b1c0a3bd40 /lib/PublicInbox/SolverGit.pm | |
parent | 1f1dd03147b2537bb641fed3ac31986f65defefd (diff) | |
download | public-inbox-71883b865aa814445c9cf8160a25c3a5d474cb55.tar.gz |
..if the Email::MIME ->crlf is LF. Email::MIME::Encodings forces everything to CRLF on quoted-printable messages for RFC-compliance; and git-apply --ignore-whitespace seems to miss a context line which is just "\r\n" (w/o leading space).
Diffstat (limited to 'lib/PublicInbox/SolverGit.pm')
-rw-r--r-- | lib/PublicInbox/SolverGit.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index 8fde2329..612f495b 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -78,6 +78,14 @@ sub extract_diff ($$$$) { my ($s, undef) = msg_part_text($part, $ct); defined $s or return; my $di = {}; + + # Email::MIME::Encodings forces QP to be CRLF upon decoding, + # change it back to LF: + my $cte = $part->header('Content-Transfer-Encoding') || ''; + if ($cte =~ /\bquoted-printable\b/i && $part->crlf eq "\n") { + $s =~ s/\r\n/\n/sg; + } + foreach my $l (split(/^/m, $s)) { if ($l =~ $re) { $di->{oid_a} = $1; |