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

Re: [PATCH] bundle-uri: copy all bundle references ino the refs/bundle space

From
Derrick Stolee <stolee@gmail.com>
Date
Feb 25, 2025, 23:36 UTC
Message-ID
<3a180cca-0573-474a-8835-8015dbe09541@gmail.com>
In-Reply-To
<xmqqv7sxki36.fsf@gitster.g>
On 2/25/25 1:14 PM, Junio C Hamano wrote:
Show 8 quoted lines
> "Scott Chacon via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>>      Furthermore, when I bundled just a tag (thinking it would have most
>>      reachable objects) it completely failed to work because there were no
>>      refs/heads/ available for negotiation - so it downloaded a huge file and
>>      then still started from scratch on the fetch.
> 
> Nice finding.

This is an interesting case that I had not considered in the original implementation.

The intention of the design is to avoid having the bundle URI fetch changing tag refs, especially annotated tags. Those tag updates are expected to be advertised in the "git fetch" output. It would probably be best to peel the tag refs to a commit and then create a fake branch for the bundle.

Show 46 quoted lines
>>      Now I'm only getting an extra 43k objects, so 1% of the original total,
>>      and the entire operation is a bit faster as well.
> 
> That makes all sense.
> 
>>      I'm not sure if there is a downside here, it seems clearly how you would
>>      want the negotiation to go. It ends up with way more refs under
>>      refs/bundle (now there is refs/bundle/origin/master, etc) but that's
>>      being polluted by the head refs anyhow, right?
> 
> I am not sure what you mean by "being polluted by the head refs
> anyhow", but we should be equipped to deal with a repository with
> tons of local branches, so having the comparable number of
> remote-tracking branches instead of local branches now exposed in
> refs/bundle/remotes/* hierarchy should work equally as well, or we
> would have something we need to fix.  So in principle I do not see
> a problem with this approach.
> 
> The mapping used to be "refs/heads/foo" to "refs/bundles/foo", but
> now "refs/heads/foo" is mapped to "refs/bundles/heads/foo", so that
> you would presumably be mapping "refs/remotes/origin/master" to
> "refs/bundles/remotes/origin/master", right?  I hope existing users
> are *not* looking at their resulting refs/bundles/ hierarchy and
> somehow assuming the original mapping.
> 
> This is not something this "fix" changes, but unbundle_all_bundles()
> apparently is prepared to handle more than one bundles.  I wonder
> what happens when multiple bundles expose the same branch pointing
> at different objects?  The way I read unbundle_from_file() is that
> a new one overwrites the previous value, so even though we may have
> all unbundled many bundles, the objects from earlier bundles may
> lose their anchors, subject to be garbage-collected.
> 
> Imagine creating a bundle with two refs, refs/heads and
> refs/remotes, and append that bundle as the last bundle of a bunch
> of bundles full of local and remote-tracking branches, that have
> populated refs/bundles/ hierarchy with tons of refs.  Now the last
> bundle is unbundled, and these two phoney refs would nuke everything
> that used to be under refs/bundles/heads/* and refs/bundles/remotes/*
> left by unpacking previous bundles, right?
> 
>>      Is this a reasonable change?
> 
> This is mostly Stolee's design, IIRC, so I have CC'ed; the work is
> mostly from 53a50892 (bundle-uri: create basic file-copy logic,
> 2022-08-09) that is more than 2 years ago.

The biggest question I had (and tried to get ahead of on the PR) is the use of a test to demonstrate what kind of bundle files cause this issue. It would be important to demosntrate that the repo is still usable if "refs/bundles/tags/v1.0" exists and points to a tag object.

>> -		if (!skip_prefix(refname->string, "refs/heads/", &branch_name))
>> +		if (!skip_prefix(refname->string, "refs/", &branch_name))
>>   			continue;

So I'm OK with relaxing this to be more flexible, but I'm not sure why the bundles couldn't be created using "refs/heads/", possibly via changing the ref names during bundle creation.

Show 8 quoted lines
> By skipping only "refs/", "branch_name" is no longer a branch name,
> which may be something we may want to fix, but if we were to address
> the "names from later bundles seem to overwrite names used by
> previous boundles, and unanchor objects obtained from them" problem,
> I suspect we'd rather want to create new and unique names there,
> without assuming or relying on that the names used by these bundles
> are reasonably unique, so this part of the code may have to change
> anyway, so we may not care too deeply at this point.

Thanks, -Stolee

Previous: Junio C HamanoNext: Scott Chacon
Message 3 of 37 in “bundle-uri: copy all bundle references ino the refs/bundle space”
  1. bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Feb 25, 2025
  2. Junio C HamanoFeb 25, 2025
  3. Derrick StoleeFeb 25, 2025
  4. Scott ChaconMar 1, 2025
  5. Junio C HamanoMar 3, 2025
  6. Derrick StoleeMar 3, 2025
  7. 0/3 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Mar 1, 2025
  8. 1/3 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Mar 1, 2025
  9. 2/3 bundle-uri: update bundle clone tests with new refspec pathScott Chacon via GitGitGadget, Mar 1, 2025
  10. 3/3 bundle-uri: add test for bundle-uri clones with tagsScott Chacon via GitGitGadget, Mar 1, 2025
  11. Derrick StoleeMar 3, 2025
  12. 0/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Mar 18, 2025
  13. 1/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Mar 18, 2025
  14. Phillip WoodMar 19, 2025
  15. 2/2 bundle-uri: add test for bundle-uri clones with tagsScott Chacon via GitGitGadget, Mar 18, 2025
  16. Phillip WoodMar 19, 2025
  17. Taylor BlauMar 19, 2025
  18. Toon ClaesApr 14, 2025
  19. Scott ChaconApr 25, 2025
  20. Junio C HamanoMar 21, 2025
  21. 0/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  22. 1/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  23. 2/2 bundle-uri: add test for bundle-uri clones with tagsScott Chacon via GitGitGadget, Apr 25, 2025
  24. Scott ChaconApr 25, 2025
  25. Phillip WoodApr 25, 2025
  26. Junio C HamanoApr 25, 2025
  27. 0/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  28. 2/2 bundle-uri: add test for bundle-uri clones with tagsScott Chacon via GitGitGadget, Apr 25, 2025
  29. 1/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  30. 0/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  31. 1/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  32. 2/2 bundle-uri: add test for bundle-uri clones with tagsScott Chacon via GitGitGadget, Apr 25, 2025
  33. 0/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  34. 2/2 bundle-uri: add test for bundle-uri clones with tagsScott Chacon via GitGitGadget, Apr 25, 2025
  35. 1/2 bundle-uri: copy all bundle references ino the refs/bundle spaceScott Chacon via GitGitGadget, Apr 25, 2025
  36. Junio C HamanoApr 25, 2025
  37. Phillip WoodApr 29, 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.