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,AWL,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 3EFA61F953; Mon, 8 Nov 2021 21:27:14 +0000 (UTC) Date: Mon, 8 Nov 2021 21:27:14 +0000 From: Eric Wong To: Rob Herring Cc: Konstantin Ryabitsev , meta@public-inbox.org Subject: [PATCH] searchidx: index "diff --git a/... b/..." headers Message-ID: <20211108212714.GA13642@dcvr> References: <20211108202204.q5zg6bachnvbjlnx@meerkat.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: Rob Herring wrote: > On Mon, Nov 8, 2021 at 2:22 PM Konstantin Ryabitsev > > I think 's:patch AND nq:diff' is a good option here. > > Not even close really. That mainly finds my replies with 'diff' in > them. I'm not sure why, but it misses most actual patches: > > https://lore.kernel.org/all/?q=s%3Apatch+nq%3Adiff+f%3Arobh%40kernel.org Actually, it looks like nq:diff never works. The diff indexer skips right over 'diff --git a/... b/...' lines :x The following should fix it, but reindexing is necessary. ---------8<---------- Subject: [PATCH] searchidx: index "diff --git a/... b/..." headers While we do detailed indexing of git diffs, the header itself was failing and queries like 'nq:diff' would not work. Noticed-by: Rob Herring --- lib/PublicInbox/SearchIdx.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index b886ce78..6e2e614c 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -259,6 +259,7 @@ sub index_diff ($$$) { } elsif (m!^diff --git "?[^/]+/.+ "?[^/]+/.+\z!) { # wait until "---" and "+++" to capture filenames $in_diff = 1; + push @xnq, $_; # traditional diff: } elsif (m/^diff -(.+) (\S+) (\S+)$/) { my ($opt, $fa, $fb) = ($1, $2, $3);