From: Jeff King Date: Tue, 04 Mar 2025 07:51:13 GMT Subject: Re: The transfer.hideRefs of the upload-pack process does not work properly Message-ID: <20250304075113.GD1283943@coredump.intra.peff.net> In-Reply-To: On Fri, Feb 28, 2025 at 10:32:01AM +0800, SURA wrote: > My previous description was not clear enough. The early hiding > according to exclude_patterns in packed_ref_iterator_begin seems to be > designed for git for-each-ref's exclude. It is different from the > ref_hidden matching rule used by upload-pack. 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. So probably the solution is for the jump list in 59c35fac54 to be pickier about finding its start/end points. It should insist on a trailing "/" (I think end-of-string would also be valid, but it may be easier to ignore that, and it is OK to err on the side of inclusion, since the caller is supposed to do their own filtering). Probably the logic needs to go into cmp_record_to_refname(), but I lack sufficient brain power at this time of night to even attempt a fix. The smallest reproduction for me is: git init git commit --allow-empty -m foo git pack-refs --all git -c transfer.hiderefs=refs/he upload-pack . which shows "refs/heads/main" (or "master") before 59c35fac54, but not after. -Peff