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

Re: Efficiency of initial clone from server

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 12, 2007, 17:04 UTC
Message-ID
<20070212170403.GA29621@spearce.org>
In-Reply-To
<9e4733910702120840p3fd2a18ar2e3b91564556dc43@mail.gmail.com>
Jon Smirl <jonsmirl@gmail.com> wrote:
Show 12 quoted lines
> On 2/12/07, Jon Smirl <jonsmirl@gmail.com> wrote:
> >On 2/12/07, Junio C Hamano <junkio@cox.net> wrote:
> >> Time to learn to use --reference perhaps?
> >>
> >>         git clone --reference linux-2.6 
> >git://.../linville/wireless-dev.git
> >>
> >> where "linux-2.6" is local repository which is my personal copy
> >> of Linus's repo.
> 
> Does this use hard links so that if I whack my linux-2.6 it won't also
> destroy my wireless-dev repo?

No. It uses a Git specific 'symlink workalike'. We record the path to the reference repository in the plain text file

  .git/objects/info/alternates

This file can list multiple repositories that this repository borrows objects from. If you delete any of those, then this repository will likely lose access to objects it thinks should be here, thereby totally screwing this repository.

There's also some risk with repacking or pruneing the reference source (your linux-2.6 repository) as that repository doesn't know what objects it has which it itself doesn't need, but which are in use by the other repositories.

The easiest way to prevent this from destroying a repository later on is to make your shiny new wireless-dev clone standalone by completely repacking it after creation (*without* -l !) :

  git repack -a -d
  rm .git/objects/info/alternates

Another solution is don't clone from the remote, but instead clone locally then update the origin and refetch:

  git clone -l -n linux-2.6 wireless-dev
  cd wireless-dev
  git config remote.origin.url git://.../linville/wireless-dev.git
  git fetch

The initial clone will setup hardlinks, but also uses the wrong origin URL. Hence we have to change it just before we attempt to fetch from wireless-dev.

-- 
Shawn.
Previous: Jon SmirlNext: Johannes Schindelin
Message 27 of 32 in “Efficiency of initial clone from server”
  1. Jon SmirlFeb 11, 2007
  2. Shawn O. PearceFeb 11, 2007
  3. Jon SmirlFeb 11, 2007
  4. Jon SmirlFeb 11, 2007
  5. Nicolas PitreFeb 12, 2007
  6. Jon SmirlFeb 12, 2007
  7. Nicolas PitreFeb 12, 2007
  8. Shawn O. PearceFeb 12, 2007
  9. Nicolas PitreFeb 12, 2007
  10. Junio C HamanoFeb 12, 2007
  11. Jon SmirlFeb 12, 2007
  12. Junio C HamanoFeb 12, 2007
  13. Jon SmirlFeb 12, 2007
  14. Jon SmirlFeb 12, 2007
  15. Shawn O. PearceFeb 12, 2007
  16. Jon SmirlFeb 12, 2007
  17. Nicolas PitreFeb 12, 2007
  18. Theodore TsoFeb 12, 2007
  19. Junio C HamanoFeb 12, 2007
  20. Nicolas PitreFeb 12, 2007
  21. Jakub NarebskiFeb 13, 2007
  22. Junio C HamanoFeb 12, 2007
  23. Jon SmirlFeb 12, 2007
  24. Junio C HamanoFeb 12, 2007
  25. Jon SmirlFeb 12, 2007
  26. Jon SmirlFeb 12, 2007
  27. Shawn O. PearceFeb 12, 2007
  28. Johannes SchindelinFeb 12, 2007
  29. Jon SmirlFeb 12, 2007
  30. Shawn O. PearceFeb 12, 2007
  31. Andreas EricssonFeb 13, 2007
  32. Jon SmirlFeb 11, 2007

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.