From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 712B11F466 for ; Fri, 3 Jan 2020 08:46:03 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/6] searchidx: index_diff: allow /^$/ line as diff context Date: Fri, 3 Jan 2020 08:45:58 +0000 Message-Id: <20200103084603.8405-2-e@80x24.org> In-Reply-To: <20200103084603.8405-1-e@80x24.org> References: <20200103084603.8405-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 '';