From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Taylor Blau <me@ttaylorr.com>,
git@vger.kernel.org, Jeff King <peff@peff.net>,
Elijah Newren <newren@gmail.com>, SURA <surak8806@gmail.com>
Subject: Re: [PATCH v2 2/2] refs.c: stop matching non-directory prefixes in exclude patterns
Date: Fri, 07 Mar 2025 09:31:17 -0800 [thread overview]
Message-ID: <xmqq7c50g32y.fsf@gitster.g> (raw)
In-Reply-To: <Z8q99U9u6HQvHXFT@pks.im> (Patrick Steinhardt's message of "Fri, 7 Mar 2025 10:35:49 +0100")
Patrick Steinhardt <ps@pks.im> writes:
> I think you've swapped things around a bit by accident. The problem is
> that the patterns were being matched too loosely by the underlying
> backends, which had the consequence that the backends marked too many
> refs as excluded.
OK, I agree it is confusing. As a selection mechanism for refs to
be shown or processed, exclusion should be "we omit it because we
clearly know this one should not be in the final result, but we may
pass questionable ones, relying on our caller to have the final
say". As a selection mechanism for refs to be excluded, the logic
should be the other way around, so false positive and false negative
are going to be swapped. We want the exclusion at the lower layer
to only say "this ref clearly matches with given exclusion pattern",
but we used to claim matches for refs that shouldn't match.
OK. Thanks for straightening me out.
> What makes me feel a bit uneasy is that for the "files" backend the
> optimization depends on the packed state, which is quite awkward overall
> as our tests may not uncover issues only because we didn't pack refs. I
> don't really see a way to address this potential test gap generically
> though.
True. An obvious optimization for "files" _might_ be to lazily walk
the directory hierarchy and skip recursive readdir when a directory
clearly matches the given exclusion pattern, but the result of such
an optimization (in other words, what would seep through the sieve)
to be filtered out at the upper layer would be different from what
the "packed-refs" backend does for its optimization, and they would
be different for reftable or any other future backends.
But I think that is the nature of lower-level optimization---each
backend takes advantage of intimately knowing how it organizes the
underlying data, and how they can omit without looking into a bulk
of the section of data deeply would be different.
Thanks.
next prev parent reply other threads:[~2025-03-07 17:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 1:19 [PATCH 0/2] refs: a couple of --exclude fixes Taylor Blau
2025-03-06 1:19 ` [PATCH 1/2] refs.c: remove empty '--exclude' patterns Taylor Blau
2025-03-06 1:19 ` [PATCH 2/2] refs.c: unify '--exclude' behavior between files and packed backends Taylor Blau
2025-03-06 8:47 ` Patrick Steinhardt
2025-03-06 14:54 ` Taylor Blau
2025-03-06 15:34 ` [PATCH v2 0/2] refs: a couple of --exclude fixes Taylor Blau
2025-03-06 15:34 ` [PATCH v2 1/2] refs.c: remove empty '--exclude' patterns Taylor Blau
2025-03-07 21:32 ` Elijah Newren
2025-03-07 23:37 ` Taylor Blau
2025-03-07 23:58 ` Elijah Newren
2025-03-06 15:34 ` [PATCH v2 2/2] refs.c: stop matching non-directory prefixes in exclude patterns Taylor Blau
2025-03-06 17:27 ` Junio C Hamano
2025-03-07 9:35 ` Patrick Steinhardt
2025-03-07 17:31 ` Junio C Hamano [this message]
2025-03-07 23:42 ` Taylor Blau
2025-03-07 21:31 ` Elijah Newren
2025-03-07 23:46 ` Taylor Blau
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=xmqq7c50g32y.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
--cc=surak8806@gmail.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;
as well as URLs for NNTP newsgroup(s).