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

Re: git clone sending unneeded objects

From
Nicolas Pitre <nico@fluxnic.net>
Date
Sep 27, 2009, 01:27 UTC
Message-ID
<alpine.LFD.2.00.0909262059520.4997@xanadu.home>
In-Reply-To
<4ABD9C2C.60800@redhat.com>
On Sat, 26 Sep 2009, Jason Merrill wrote:
Show 14 quoted lines
> Incidentally, somewhat related to this issue, I've noticed that if I fetch a
> branch which I don't currently have in my repository, and I have most of the
> commits on that branch in my object store (or in an alternate repository) but
> not the most recent commit, git fetch isn't smart enough to only grab the
> commits I'm actually missing, it wants to fetch much more.
> 
> I would expect that since the clone pulled down everything in the gcc.git
> repository, I could then do
> 
> git config remote.origin.fetch 'refs/remotes/*:refs/remotes/origin/*'
> git fetch
> 
> and have all the branches, not just the ones in refs/heads.  But when I do
> this git fetch wants to fetch some 500k redundant objects.

Well... Assuming a fixed git using the patch I posted yesterday, my clone of gcc.git has 988941 objects. The source repository used for the clone has 1399551 objects. Of course the source repo has more objects because it has extra branches in the refs/remotes/ namespace that the clone didn't fetch. If you wish to also fetch those branches as you illustrated above then you'll get the difference i.e. 410610 additional objects.

And even if the broken clone (before my patch) did pull everything from gcc.git, in the cloned repository those 410610 extra objects are considered as garbage because nothing actually reference them. So even if you decide to fetch the extra branches that the initial clone didn't pick up, or if you do reference that repository with "garbage" objects for another clone to which you want to add those extra branches, git has no way to know that it already had access to those objects locally and "ungarbage" them as they aren't referenced. Result is a useless fetch of 410610 objects that you already have, but that you weren't supposed to have in the first place.

Nicolas
Previous: Nicolas PitreNext: Shawn O. Pearce
Message 21 of 26 in “Re: git gc expanding packed data?”
  1. Andreas SchwabAug 8, 2009
  2. Hin-Tak LeungAug 8, 2009
  3. Andreas SchwabAug 8, 2009
  4. Nicolas PitreAug 9, 2009
  5. Andreas SchwabAug 9, 2009
  6. Jason MerrillSep 25, 2009
  7. Matthieu MoySep 25, 2009
  8. Jason MerrillSep 25, 2009
  9. Nicolas PitreSep 25, 2009
  10. Jason MerrillSep 25, 2009
  11. Nicolas PitreSep 25, 2009
  12. Jason MerrillSep 25, 2009
  13. Nicolas PitreSep 26, 2009
  14. make 'git clone' ask the remote only for objects it cares aboutNicolas Pitre, Sep 26, 2009
  15. Andreas SchwabSep 26, 2009
  16. Shawn O. PearceSep 26, 2009
  17. Nicolas PitreSep 27, 2009
  18. Jason MerrillSep 26, 2009
  19. Jason MerrillSep 26, 2009
  20. Nicolas PitreSep 27, 2009
  21. Nicolas PitreSep 27, 2009
  22. Shawn O. PearceSep 27, 2009
  23. Nicolas PitreSep 27, 2009
  24. Jason MerrillSep 27, 2009
  25. Nicolas PitreSep 28, 2009
  26. Hin-Tak LeungSep 26, 2009

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.