lib/PublicInbox/SolverGit.pm | 18 +++++++++++++++--- diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index 13065348b1da882c23843df3268de017106f7f1a..8fde2329fa757a639aba76375c4ab63ffa55ab1b 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -105,6 +105,11 @@ return $di if $tmp; # got our blob, done! my ($path_a, $path_b) = ($1, $2); + # diff header lines won't have \r because git + # will quote them, but Email::MIME gives CRLF + # for quoted-printable: + $path_b =~ tr/\r//d; + # don't care for leading 'a/' and 'b/' my (undef, @a) = split(m{/}, git_unquote($path_a)); my (undef, @b) = split(m{/}, git_unquote($path_b)); @@ -248,8 +253,11 @@ sysseek($tmp, 0, SEEK_SET) or die "sysseek(tmp) failed: $!"; defined(my $err_fd = fileno($out)) or die "fileno(out): $!"; my $rdr = { 0 => fileno($tmp), 1 => $err_fd, 2 => $err_fd }; + + # we need --ignore-whitespace because some patches are CRLF my $cmd = [ qw(git -C), $wt_dir, - qw(apply --cached --whitespace=warn --verbose) ]; + qw(apply --cached --ignore-whitespace + --whitespace=warn --verbose) ]; spawn($cmd, undef, $rdr); } @@ -425,8 +433,12 @@ ''; # continue onto next @todo item; }; while (1) { - my $ret = $cb->(); - return $ret if (ref($ret) || !defined($ret)); + my $ret = eval { $cb->() }; + unless (defined($ret)) { + print $out "E: $@\n" if $@; + return; + } + return $ret if ref($ret); # $ret == ''; so continue looping here } }