about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-01-03 08:45:58 +0000
committerEric Wong <e@80x24.org>2020-01-04 09:34:47 +0000
commit28bfb760619eb4225b469df900d14fb70741604d (patch)
treeb4169767087d9e57dd0cf0d05005f3964296512b /lib
parentaa1e96cd44f6d5cd77a96648ac1f2dbcca9dc367 (diff)
downloadpublic-inbox-28bfb760619eb4225b469df900d14fb70741604d.tar.gz
As discovered by solver bug hunting, "git apply" also handles
the case where blank lines w/o leading space are treated as diff
context, apparently because GNU diff once did it:

https://public-inbox.org/git/b507b465f7831612b9d9fc643e3e5218b64e5bfa/s/
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/SearchIdx.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 21ab8119..4cfbc4aa 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -255,7 +255,9 @@ sub index_diff ($$$) {
                                 /^Binary files .* differ/) {
                         push @xnq, $_;
                 } elsif ($_ eq '') {
-                        $in_diff = undef;
+                        # possible to be in diff context, some mail may be
+                        # stripped by MUA or even GNU diff(1).  "git apply"
+                        # treats a bare "\n" as diff context, too
                 } else {
                         push @xnq, $_;
                         warn "non-diff line: $_\n" if DEBUG && $_ ne '';