git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>, Elijah Newren <newren@gmail.com>,
	SURA <surak8806@gmail.com>
Subject: Re: [PATCH 2/2] refs.c: unify '--exclude' behavior between files and packed backends
Date: Thu, 6 Mar 2025 09:54:42 -0500	[thread overview]
Message-ID: <Z8m3Mo+3l0IxzyOH@nand.local> (raw)
In-Reply-To: <Z8lhKT2KuM3VJ7d-@pks.im>

On Thu, Mar 06, 2025 at 09:47:37AM +0100, Patrick Steinhardt wrote:
> On Wed, Mar 05, 2025 at 08:19:53PM -0500, Taylor Blau wrote:
>
> Nit: I'd reword the commit subject to not only talk about "files" and
> "packed" backends. Or maybe not mention the backend at all, as it is the
> same bug for every backend that implements excludes. Something like
> "refs: stop matching non-directory prefixes in exclude patterns", for
> example.

Fair enough.

> > diff --git a/t/t1419-exclude-refs.sh b/t/t1419-exclude-refs.sh
> > index fd58260a24..d955cf9541 100755
> > --- a/t/t1419-exclude-refs.sh
> > +++ b/t/t1419-exclude-refs.sh
> > @@ -101,7 +101,7 @@ test_expect_success 'adjacent, non-overlapping excluded regions' '
> >
> >  test_expect_success 'overlapping excluded regions' '
> >  	for_each_ref__exclude refs/heads refs/heads/ba refs/heads/baz >actual 2>perf &&
> > -	for_each_ref refs/heads/foo refs/heads/quux >expect &&
> > +	for_each_ref refs/heads/bar refs/heads/foo refs/heads/quux >expect &&
> >
> >  	test_cmp expect actual &&
> >  	assert_jumps 1 perf
>
> I was wondering whether this still tests the right thing. But the ranges
> still are overlapping, as "refs/heads" and "refs/heads/baz" are. So
> judging by the test description it seems to still do what's advertised.

That's not quite true. for_each_ref__exclude treats its first argument
as the positive half of the query, and the remaining arguments as
exclusions. So the only excluded regions here are "refs/heads/ba" and
"refs/heads/baz", which were overlapping prior to this patch but aren't
anymore.

So this test isn't quite doing what it says it is anymore, and should
really be called "non-directory excluded regions" or similar. But we
should still have a separate test that does cover excluded regions,
which needs a new layer underneath some hirearchy, e.g., having
"refs/heads/bar/x/..." and "refs/heads/bar" as the excluded regions.

I adjusted those and will push out a new version with the results
shortly. Thanks for reading closely.

Thanks,
Taylor

  reply	other threads:[~2025-03-06 14:54 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 [this message]
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
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=Z8m3Mo+3l0IxzyOH@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).