mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Hamdy Abou El Anein <info@daylightlinux.ch>
Cc: Hamdy Abou El Anein <hamdy.aea@protonmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts: git-resolve: search beyond ten body-only matches
Date: Tue,  3 Nov 2026 12:26:27 -0500	[thread overview]
Message-ID: <20261103172629.1393309-2-sashal@kernel.org> (raw)
In-Reply-To: <20261103164202.129634-1-info@daylightlinux.ch>

On Tue, Nov 03, 2026 at 05:42:02PM +0100, Hamdy Abou El Anein wrote:
>The forced subject lookup asks git log for at most ten matches before
>checking their subjects. Since --grep also searches message bodies, ten
>newer body-only matches can hide an older commit with the requested
>subject.
>
>Remove the premature limit. The existing reader still stops at the
>first matching subject.

The fix is correct, but without the limit a broad wildcard that matches many
bodies and no subject gets slow. In linux.git, --force 999999999
'("...Tested-by...")' went from returning immediately to over a minute, since
the loop runs grep once for each of the 78000 commits whose message matches.

Matching the subject directly avoids body matches altogether:

	match=$(git log --format="%H %s" | grep -m1 -P "^[0-9a-f]+ ${grep_pattern#^}" | cut -d" " -f1)

No limit is needed then. It gives the same results on the selftest and on your
eleven commit case, finds an existing subject in 0.1s instead of 10s, and takes
12s for the wildcard above. It also resolves subjects with leading whitespace
or that span several lines, which the read loop misses today.

Could you send a v2 that does this instead?

-- 
Thanks,
Sasha

      reply	other threads:[~2026-11-03 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:42 Hamdy Abou El Anein
2026-11-03 17:26 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261103172629.1393309-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hamdy.aea@protonmail.com \
    --cc=info@daylightlinux.ch \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®