From: Patrick Steinhardt <ps@pks.im>
To: karthik nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH 1/6] refs: properly apply exclude patterns to namespaced refs
Date: Mon, 16 Sep 2024 08:56:10 +0200 [thread overview]
Message-ID: <ZufWilh3WupDnVWf@pks.im> (raw)
In-Reply-To: <CAOLa=ZTM9N0i+8jDp24pp1DdU1mmwU02L4vOP6GOpGW-=SJUoQ@mail.gmail.com>
On Fri, Sep 13, 2024 at 04:35:35AM -0700, karthik nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > Handling such exclude patterns in `refs_for_each_namespaced_ref()` and
> > `refs_for_each_fullref_in_prefixes()` is broken though, as both support
> > that the user passes both namespaces and exclude patterns. In the case
> > where both are set we will exclude references with unstripped names,
> > even though we really wanted to exclude references based on their
> > stripped names.
> >
> > This only surfaces when:
> >
> > - A repository uses reference namespaces.
> >
> > - "transfer.hideRefs" is active.
> >
> > - The namespaced references are packed into the "packed-refs" file.
> >
>
> So this is because we don't even apply exclude patterns to the loose
> refs right?
>
> To understand correctly, the transport layer passes on
> 'transfer.hideRefs' as `exclude_refs` to the generic refs layer. This is
> mostly to optimize the reference backend to skip such refs. This is used
> by the packed-refs currently but not used for loose refs.
>
> The transfer layer also uses this list in `mark_our_ref()` to skip refs
> as needed.
>
> So all in all `exclude_refs` here is mostly for optimization.
Yup.
> > diff --git a/refs.c b/refs.c
> > index ceb72d4bd74..b3a367ea12c 100644
> > --- a/refs.c
> > +++ b/refs.c
> > @@ -1517,6 +1517,19 @@ const char **hidden_refs_to_excludes(const struct strvec *hide_refs)
> > return hide_refs->v;
> > }
> >
> > +const char **get_namespaced_exclude_patterns(const char **exclude_patterns,
> > + const char *namespace,
> > + struct strvec *out)
> > +{
> > + if (!namespace || !*namespace || !exclude_patterns || !*exclude_patterns)
>
> What scenario would `!*namespace` be possible?
It's the default value of `get_git_namespace()`.
> > diff --git a/refs.h b/refs.h
> > index f8b919a1388..3f774e96d18 100644
> > --- a/refs.h
> > +++ b/refs.h
> > @@ -859,6 +859,15 @@ int ref_is_hidden(const char *, const char *, const struct strvec *);
> > */
> > const char **hidden_refs_to_excludes(const struct strvec *hide_refs);
> >
> > +/*
> > + * Prefix all exclude patterns with the namespace, if any. This is required
> > + * because exclude patterns apply to the stripped reference name, not the full
> > + * reference name with the namespace.
> > + */
> > +const char **get_namespaced_exclude_patterns(const char **exclude_patterns,
> > + const char *namespace,
> > + struct strvec *out);
> > +
>
> Do we need to expose this? Can't it be made static?
It will be used by the next patch. I'll amen the commit message to point
this out.
Patrick
next prev parent reply other threads:[~2024-09-16 6:56 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 11:31 [PATCH 0/6] refs/reftable: wire up exclude patterns Patrick Steinhardt
2024-09-09 11:31 ` [PATCH 1/6] refs: properly apply exclude patterns to namespaced refs Patrick Steinhardt
2024-09-13 11:35 ` karthik nayak
2024-09-16 6:56 ` Patrick Steinhardt [this message]
2024-09-09 11:31 ` [PATCH 2/6] builtin/receive-pack: fix exclude patterns when announcing refs Patrick Steinhardt
2024-09-13 11:50 ` karthik nayak
2024-09-09 11:31 ` [PATCH 3/6] Makefile: stop listing test library objects twice Patrick Steinhardt
2024-09-09 11:31 ` [PATCH 4/6] t/unit-tests: introduce reftable library Patrick Steinhardt
2024-09-09 11:31 ` [PATCH 5/6] reftable/reader: make table iterator reseekable Patrick Steinhardt
2024-09-13 12:11 ` karthik nayak
2024-09-16 6:56 ` Patrick Steinhardt
2024-09-17 16:44 ` karthik nayak
2024-09-09 11:31 ` [PATCH 6/6] refs/reftable: wire up support for exclude patterns Patrick Steinhardt
2024-09-13 12:47 ` karthik nayak
2024-09-16 6:56 ` Patrick Steinhardt
2024-09-17 17:31 ` karthik nayak
2024-09-13 12:48 ` [PATCH 0/6] refs/reftable: wire up " karthik nayak
2024-09-16 6:56 ` Patrick Steinhardt
2024-09-16 8:49 ` [PATCH v2 " Patrick Steinhardt
2024-09-16 8:50 ` [PATCH v2 1/6] refs: properly apply exclude patterns to namespaced refs Patrick Steinhardt
2024-09-17 9:12 ` Taylor Blau
2024-09-17 9:33 ` Patrick Steinhardt
2024-09-17 9:38 ` Taylor Blau
2024-09-17 9:44 ` Patrick Steinhardt
2024-09-17 9:52 ` Taylor Blau
2024-09-17 9:55 ` Patrick Steinhardt
2024-09-16 8:50 ` [PATCH v2 2/6] builtin/receive-pack: fix exclude patterns when announcing refs Patrick Steinhardt
2024-09-17 9:16 ` Taylor Blau
2024-09-16 8:50 ` [PATCH v2 3/6] Makefile: stop listing test library objects twice Patrick Steinhardt
2024-09-16 8:50 ` [PATCH v2 4/6] t/unit-tests: introduce reftable library Patrick Steinhardt
2024-09-16 8:50 ` [PATCH v2 5/6] reftable/reader: make table iterator reseekable Patrick Steinhardt
2024-09-16 8:50 ` [PATCH v2 6/6] refs/reftable: wire up support for exclude patterns Patrick Steinhardt
2024-09-17 9:26 ` Taylor Blau
2024-09-17 9:39 ` Patrick Steinhardt
2024-09-17 9:53 ` Taylor Blau
2024-09-17 17:33 ` [PATCH v2 0/6] refs/reftable: wire up " karthik nayak
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=ZufWilh3WupDnVWf@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=me@ttaylorr.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).