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

Re: [PATCH v2 2/4] pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"

From
Patrick Steinhardt <ps@pks.im>
Date
Feb 6, 2026, 07:13 UTC
Message-ID
<aYWUnM7aA5SJBdwS@pks.im>
In-Reply-To
<aYAIVw5UMQeP3Ilr@nand.local>
On Sun, Feb 01, 2026 at 09:13:43PM -0500, Taylor Blau wrote:
Show 20 quoted lines
> On Fri, Jan 30, 2026 at 02:27:43PM +0100, Patrick Steinhardt wrote:
> > [...] There are two possible ways to fix this issue:
> >
> >   - We can fix the bug by using `refs_for_each_fullref_in()` instead,
> >     which does not strip the prefix at all. Consequently, we would now
> >     start to accept all references that start with the configured
> >     prefix, including exact matches. So if we had "refs/heads/main", we
> >     would both match "refs/heads/main" and "refs/heads/main-branch".
> >
> >   - Or we can fix the bug by appending a slash to the prefix if it
> >     doesn't already have one. This would mean that we only match
> >     ref hierarchies that start with this prefix.
> >
> > The first fix leaves the user with strictly _more_ configuration
> > options: they can have prefix matches by not appending a slash to the
> > configuration, and they can have ref hierarchy matches by appending one.
> 
> I would definitely like to err on the side of more flexible
> configuration options, but I am still concerned that this change would
> lead to somewhat surprising behavior.

I think my point is mostly that this somewhat surprising behaviour already exists right now.

Show 31 quoted lines
> A couple of thoughts:
> 
>  - Like I mentioned in the earlier round, 10e8a9352bc (refs.c: stop
>    matching non-directory prefixes in exclude patterns, 2025-03-06)
>    takes the opposite approach as what is being proposed here. I worry
>    that users will find the difference in behavior between
>    pack.preferBitmapTips and for-each-ref's --exclude patterns to be
>    confusing.
> 
>  - If a user wants to list all references that start with
>    "refs/heads/ma" in the string prefix sense (that is, matching
>    "refs/heads/ma", "refs/heads/main", "refs/heads/master" and so on),
>    then they would do
> 
>      $ git for-each-ref 'refs/heads/ma*'
> 
>    , not 'refs/heads/ma'. In fact, enumerating 'refs/heads/ma' when
>    there exist references "refs/heads/ma/foo", "refs/heads/ma/bar",
>    etc., for-each-ref will output those three references (but only
>    "refs/heads/ma" itself if it exists).
> 
> I suppose there is an argument to be made that we are dealing with
> "patterns" vs. "prefixes" here, but TBH I am not sure that is a
> distinction that is well-understood by users (nor should we expect it to
> be).
> 
> The original intent of this configuration was that "suffix" in this
> context meant directory suffix or exact match, not string suffix. The
> implementation does not match that intent, but I think there is enough
> ambiguity here that I wouldn't consider the change I'm suggesting to be
> a breaking one.

I wouldn't quite frame it in the way of ambiguity, but rather in the way of it being very niche. I would argue that almost nobody out there will use this configuration outside of hosting providers. GitHub will probably use it correctly, GitLab doesn't use it at all.

So I guess it's fine overall if we introduce a breaking change here.
> Overall, I think interpreting the pack.preferBitmapTips configuration as
> a reference pattern gives the user both (a) more flexibility in which
> references to match, and (b) does so in a way that is consistent with
> 10e8a9352bc and the existing behavior of for-each-ref.

I disagree with (a) as you can do strictly less, but being constistent with (b) might be a good thing.

At the end I'm not entirely convinced by the arguments, but as I said I don't have too much skin in the game, either. So let's take your approach.

Thanks!
Patrick
Previous: Taylor BlauNext: Patrick Steinhardt
Message 23 of 42 in “Fix misuse of `refs_for_each_ref_in()`”
  1. 0/3 Fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Jan 28, 2026
  2. 1/3 pack-bitmap: deduplicate logic to iterate over preferred bitmap tipsPatrick Steinhardt, Jan 28, 2026
  3. Karthik NayakJan 28, 2026
  4. Taylor BlauJan 29, 2026
  5. Junio C HamanoJan 29, 2026
  6. Patrick SteinhardtJan 30, 2026
  7. 2/3 pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"Patrick Steinhardt, Jan 28, 2026
  8. Karthik NayakJan 28, 2026
  9. Taylor BlauJan 29, 2026
  10. Junio C HamanoJan 29, 2026
  11. Taylor BlauJan 29, 2026
  12. Junio C HamanoJan 29, 2026
  13. Patrick SteinhardtJan 30, 2026
  14. 3/3 bisect: fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Jan 28, 2026
  15. Jeff KingJan 29, 2026
  16. Junio C HamanoJan 29, 2026
  17. Patrick SteinhardtJan 30, 2026
  18. Karthik NayakJan 28, 2026
  19. 0/4 Fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Jan 30, 2026
  20. 1/4 pack-bitmap: deduplicate logic to iterate over preferred bitmap tipsPatrick Steinhardt, Jan 30, 2026
  21. 2/4 pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"Patrick Steinhardt, Jan 30, 2026
  22. Taylor BlauFeb 2, 2026
  23. Patrick SteinhardtFeb 6, 2026
  24. 3/4 bisect: fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Jan 30, 2026
  25. 4/4 bisect: simplify string_list memory handlingPatrick Steinhardt, Jan 30, 2026
  26. Junio C HamanoJan 30, 2026
  27. Taylor BlauFeb 2, 2026
  28. 0/4 Fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Feb 6, 2026
  29. 1/4 pack-bitmap: deduplicate logic to iterate over preferred bitmap tipsPatrick Steinhardt, Feb 6, 2026
  30. 2/4 pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"Patrick Steinhardt, Feb 6, 2026
  31. Junio C HamanoFeb 6, 2026
  32. 3/4 bisect: fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Feb 6, 2026
  33. 4/4 bisect: simplify string_list memory handlingPatrick Steinhardt, Feb 6, 2026
  34. Taylor BlauFeb 18, 2026
  35. Junio C HamanoFeb 19, 2026
  36. 0/4 Fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Feb 19, 2026
  37. 1/4 pack-bitmap: deduplicate logic to iterate over preferred bitmap tipsPatrick Steinhardt, Feb 19, 2026
  38. 2/4 pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"Patrick Steinhardt, Feb 19, 2026
  39. 3/4 bisect: fix misuse of `refs_for_each_ref_in()`Patrick Steinhardt, Feb 19, 2026
  40. 4/4 bisect: simplify string_list memory handlingPatrick Steinhardt, Feb 19, 2026
  41. Junio C HamanoFeb 26, 2026
  42. Junio C HamanoFeb 26, 2026

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.