From 28bfb760619eb4225b469df900d14fb70741604d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 3 Jan 2020 08:45:58 +0000 Subject: searchidx: index_diff: allow /^$/ line as diff context 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/ --- lib/PublicInbox/SearchIdx.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ''; -- cgit v1.2.3-24-ge0c7