git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: The transfer.hideRefs of the upload-pack process does not work properly

From
Taylor Blau <me@ttaylorr.com>
Date
Mar 4, 2025, 16:40 UTC
Message-ID
<Z8cs8Y4CVpP0QHNj@nand.local>
In-Reply-To
<Z8bmSj_Ds7ePpzBM@pks.im>
On Tue, Mar 04, 2025 at 12:38:50PM +0100, Patrick Steinhardt wrote:
Show 41 quoted lines
> On Tue, Mar 04, 2025 at 02:51:46AM -0500, Jeff King wrote:
> > On Tue, Mar 04, 2025 at 02:51:14AM -0500, Jeff King wrote:
> >
> > > From your reproduction, it looks like the issue is that for loose refs,
> > > asking for_each_ref() to exclude "refs/heads/foo" will not yield
> > > "refs/heads/foo/bar", but will yield "refs/heads/foo-bar".
> > >
> > > And that was true for packed-refs, too, before 59c35fac54
> > > (refs/packed-backend.c: implement jump lists to avoid excluded
> > > pattern(s), 2023-07-10). After that, packed-refs exclude both.
> >
> > Oh, and of course it would be interesting to know how reftables behave
> > here, too, as I think they recently learned about exclusions.
>
> Well, we have tests that explicitly verify that prefixes cause us to
> exclude such refs in t1419, "overlapping exclude regions". So the
> reftable backend is bug-compatible :)
>
> Guess we'll need something similar to the following:
>
> diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
> index 7e90e13f745..45462f2ce6d 100644
> --- a/refs/reftable-backend.c
> +++ b/refs/reftable-backend.c
> @@ -594,6 +594,16 @@ static int should_exclude_current_ref(struct reftable_ref_iterator *iter)
>  		if (cmp < 0)
>  			return 0;
>
> +		/*
> +		 * The exclude pattern needs to either match exactly, or, if it
> +		 * is a prefix of the given reference, it must be a containing
> +		 * directory.
> +		 */
> +		if (iter->ref.refname[iter->exclude_patterns_strlen] &&
> +		    pattern[iter->exclude_patterns_strlen - 1] != '/' &&
> +		    iter->ref.refname[iter->exclude_patterns_strlen] != '/')
> +			return 0;
> +
>  		/*
>  		 * The reference shares a prefix with the exclude pattern and
>  		 * shall thus be omitted. We skip all references that match the

Ah, makes sense. Thanks, both, for looking a little deeper. I can work on a fix shortly...

Thanks, Taylor

Previous: Patrick SteinhardtNext: Taylor Blau
Message 7 of 10 in “The transfer.hideRefs of the upload-pack process does not work properly”
  1. SURAFeb 27, 2025
  2. Taylor BlauFeb 28, 2025
  3. SURAFeb 28, 2025
  4. Jeff KingMar 4, 2025
  5. Jeff KingMar 4, 2025
  6. Patrick SteinhardtMar 4, 2025
  7. Taylor BlauMar 4, 2025
  8. Taylor BlauMar 6, 2025
  9. Taylor BlauMar 5, 2025
  10. Junio C HamanoMar 5, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.