From: Eric Wong Date: Sat, 25 Jan 2020 04:45:05 +0000 (+0000) Subject: searchidx: skip filenames on "diff --git ..." X-Git-Tag: v1.3.0~51 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=9aa510cd3c4563b375ca4fc9a821db832ab88081 searchidx: skip filenames on "diff --git ..." We already capture filenames on the lines beginning with "---" and "+++", so it's redundant work to capture filenames from "diff --git ..." lines. --- diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 4349d127..f03e290e 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -209,12 +209,8 @@ sub index_diff ($$$) { index_diff_inc($self, $_, 'XDFCTX', $xnq); } elsif (/^-- $/) { # email signature begins $in_diff = undef; - } elsif (m!^diff --git ("?a/.+) ("?b/.+)\z!) { - my ($fa, $fb) = ($1, $2); - my $fn = (split('/', git_unquote($fa), 2))[1]; - $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq); - $fn = (split('/', git_unquote($fb), 2))[1]; - $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq); + } elsif (m!^diff --git "?[^/]+/.+ "?[^/]+/.+\z!) { + # wait until "---" and "+++" to capture filenames $in_diff = 1; # traditional diff: } elsif (m/^diff -(.+) (\S+) (\S+)$/) {