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, karthik nayak <karthik.188@gmail.com>
Subject: Re: [PATCH v2 2/6] builtin/receive-pack: fix exclude patterns when announcing refs
Date: Tue, 17 Sep 2024 05:16:36 -0400	[thread overview]
Message-ID: <ZulI9Ha44ZwFPoiC@nand.local> (raw)
In-Reply-To: <3dc6ae936c88d3105bc82daab3edd805c9b5c63b.1726476401.git.ps@pks.im>

On Mon, Sep 16, 2024 at 10:50:05AM +0200, Patrick Steinhardt wrote:
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index 3f35140e489..478c62ca836 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -339,12 +339,26 @@ static void show_one_alternate_ref(const struct object_id *oid,
>  static void write_head_info(void)
>  {
>  	static struct oidset seen = OIDSET_INIT;
> +	struct strvec excludes_vector = STRVEC_INIT;
> +	const char **exclude_patterns;
> +
> +	/*
> +	 * We need access to the reference names both with and without their
> +	 * namespace and thus cannot use `refs_for_each_namespaced_ref()`. We
> +	 * thus have to adapt exclude patterns to carry the namespace prefix
> +	 * ourselves.
> +	 */
> +	exclude_patterns = get_namespaced_exclude_patterns(
> +		hidden_refs_to_excludes(&hidden_refs),
> +		get_git_namespace(), &excludes_vector);

OK, so here we use the result of calling hidden_refs_to_excludes() as
the first argument to your new get_namespaced_exclude_patterns().

But I think that in this case when the caller specifies a pattern with
'^', we still do not exclude any references in the backend, since
hidden_refs_to_excludes() will return NULL when there is >1 pattern with
'^' as the first character.

I don't think that this results in broken behavior, since the callback
to the refs API will still be expected to filter out references that it
doesn't want.

>  	refs_for_each_fullref_in(get_main_ref_store(the_repository), "",
> -				 hidden_refs_to_excludes(&hidden_refs),
> -				 show_ref_cb, &seen);
> +				 exclude_patterns, show_ref_cb, &seen);
>  	for_each_alternate_ref(show_one_alternate_ref, &seen);

Thanks,
Taylor

  reply	other threads:[~2024-09-17  9:16 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
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 [this message]
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=ZulI9Ha44ZwFPoiC@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=ps@pks.im \
    /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).