about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-04-26 07:42:24 +0000
committerEric Wong <e@80x24.org>2019-04-26 07:42:24 +0000
commit0195eb10a0cb74ebe098b4596e8e78d0544df6fb (patch)
treed9a349e6c524851a24d4607db06b6d482af44301
parent31f2f298fe245d5762101bc229416b26c4e85679 (diff)
downloadpublic-inbox-0195eb10a0cb74ebe098b4596e8e78d0544df6fb.tar.gz
It seems a common case for mangled patches is editors or MUAs
dropping trailing whitespace, and lines matching /^ $/ gets
the space dropped to only match /^$/.
-rw-r--r--lib/PublicInbox/ViewDiff.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index 0cce952d..6b8d9437 100644
--- a/lib/PublicInbox/ViewDiff.pm
+++ b/lib/PublicInbox/ViewDiff.pm
@@ -146,7 +146,7 @@ sub flush_diff ($$$) {
                 if ($s =~ /^---$/) {
                         to_state($dst, $state, DSTATE_STAT);
                         $$dst .= $s;
-                } elsif ($s =~ /^ /) {
+                } elsif ($s =~ /^ / || ($s =~ /^$/ && $state >= DSTATE_CTX)) {
                         # works for common cases, but not weird/long filenames
                         if ($state == DSTATE_STAT &&
                                         $s =~ /^ (.+)( +\| .*\z)/s) {