From: Jeff King <peff@peff.net>
To: Taylor Blau <ttaylorr@openai.com>
Cc: Toon Claes <toon@iotcl.com>,
git@vger.kernel.org, Gusted <gusted@codeberg.org>
Subject: Re: [PATCH 3/4] last-modified: check pathspec against Bloom filter first
Date: Sat, 18 Jul 2026 04:37:57 -0400 [thread overview]
Message-ID: <20260718083757.GD22588@coredump.intra.peff.net> (raw)
In-Reply-To: <alq1Q55ezuN9ZI9j@com-79390>
On Fri, Jul 17, 2026 at 06:05:39PM -0500, Taylor Blau wrote:
> > diff --git a/builtin/last-modified.c b/builtin/last-modified.c
> > index 5478182f2e..e8ee610404 100644
> > --- a/builtin/last-modified.c
> > +++ b/builtin/last-modified.c
> > @@ -272,6 +272,9 @@ static bool maybe_changed_path(struct last_modified *lm,
> > if (!filter)
> > return true;
> >
> > + if (revs_maybe_changed_in_bloom(&lm->rev, filter) == 0)
>
> Nit: please prefer 'if (!foo())' over 'if (foo() == 0)'.
Yeah, though there is some subtlety here because of the tristate return
I described elsewhere in the thread. I think if we switch to a boolean
return then a straight "!" becomes even more desirable.
> I don't think this is safe with '--show-trees'. The original pathspec
> does not cover every entry in 'lm->paths', since the function
> 'populate_paths_from_revs()' also adds ancestor tree entries.
Hmm, interesting. I am surprised to learn that "-t" includes "d" when
the pathspec asked for "d/a". I thought it was mostly about showing
"d/a" when we recurse to find "d/a/b". But I guess it does not make a
distinction between the two (probably because it is just telling the
diff code to show trees, and it does not further apply the pathspec to
the output).
Does this mean there is also a bug in "git log"? I guess not, because it
is purely pruning based on the pathspec, and only shows "d/" for those
commits.
> git -c core.commitGraph=false last-modified -t HEAD -- d/a \
> >expect &&
> git -c core.commitGraph=true last-modified -t HEAD -- d/a \
> >actual &&
A minor side note: the documentation claims "-t" has no effect without
"-r", but it clearly is not true (it tells us to show "d", even when we
are not recursing).
> I think that the conditional is otherwise correct, if guarded when we
> know that 'lm->show_trees' is false, like so:
>
> if (!lm->show_trees &&
> !revs_maybe_changed_in_bloom(&lm->rev, filter))
> return false;
Hmph. That makes this optimization all but useless, because the intended
use case of last-modified is almost always going to use "-t" to be able
to mark the interior trees. And most callers are not going to care about
seeing "d" here; their purpose was to find out about the things _inside_
"d".
Would we consider removing "d" from the output for this case? Presumably
by double-checking the pathspecs again in add_path_from_diff(). That
gives less surprising output (to me, anyway) and would enable this
optimization. And the command is still marked as experimental, and I
think this is exactly the kind of corner case that is meant to cover.
-Peff
next prev parent reply other threads:[~2026-07-18 8:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 15:46 [PATCH 0/4] last-modified: use the pathspec's Bloom key to pre-filter commits Toon Claes
2026-07-17 15:46 ` [PATCH 1/4] revision: move bloom keyvec precondition into function Toon Claes
2026-07-18 7:57 ` Jeff King
2026-07-17 15:47 ` [PATCH 2/4] revision: expose check for paths maybe changed in Bloom filter Toon Claes
2026-07-17 20:47 ` Junio C Hamano
2026-07-17 23:26 ` Taylor Blau
2026-07-17 15:47 ` [PATCH 3/4] last-modified: check pathspec against Bloom filter first Toon Claes
2026-07-17 23:05 ` Taylor Blau
2026-07-18 8:37 ` Jeff King [this message]
2026-07-17 15:47 ` [PATCH 4/4] last-modified: keep per-path Bloom filters for wildcard pathspecs Toon Claes
2026-07-17 19:16 ` Toon Claes
2026-07-18 8:14 ` Jeff King
2026-07-17 23:18 ` Taylor Blau
2026-07-17 19:13 ` [PATCH 0/4] last-modified: use the pathspec's Bloom key to pre-filter commits Toon Claes
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=20260718083757.GD22588@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gusted@codeberg.org \
--cc=toon@iotcl.com \
--cc=ttaylorr@openai.com \
/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