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

Re: How de-duplicate similar repositories with alternates

From
Jeff King <peff@peff.net>
Date
Dec 4, 2018, 07:06 UTC
Message-ID
<20181204070602.GB11010@sigill.intra.peff.net>
In-Reply-To
<CAGZ79ka1sjU+rHctRP4SVMP0GQsK2iZghkU46=f96ugqvX5Neg@mail.gmail.com>
On Thu, Nov 29, 2018 at 10:55:49AM -0800, Stefan Beller wrote:
Show 15 quoted lines
> On Thu, Nov 29, 2018 at 7:00 AM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
> >
> > A co-worker asked me today how space could be saved when you have
> > multiple checkouts of the same repository (at different revs) on the
> > same machine. I said since these won't block-level de-duplicate well[1]
> > one way to do this is with alternates.
> 
> Another way is to use git-worktree, which would solve the gc issues
> mentioned below?
> 
> I view alternates as a historic artefact as the deduping
> of objects client side can be done using worktrees, and on the
> serverside - I think - most of the git hosters use namespaces
> and put a fork network into the same repository and use pack islands.

Nope, we definitely use alternates. The ref namespace support in Git is not nearly complete enough to run a modern hosting site; it only kicks in for upload-pack and receive-pack. Other commands (e.g., rev-list to traverse for a history-view page) have no support at all. So we share object storage, but not ref storage.

In theory the caller could namespace requests (e.g., the user asks for "foo", the web site feeds "refs/forks/$id/refs/heads/foo" to git). But any bugs are a lot more likely to lead to security problems (oops, you accidentally wrote into somebody else's fork!). And ref storage has traditionally been a sore point for scaling, so giving each fork its own repo and refs helps break that up.

By contrast, object storage is pretty easy to share. It scales reasonably well, and the security model is much simpler due to the immutable nature of object names.

-Peff
Previous: Duy NguyenNext: Derrick Stolee
Message 6 of 29 in “How de-duplicate similar repositories with alternates”
  1. Ævar Arnfjörð BjarmasonNov 29, 2018
  2. Ævar Arnfjörð BjarmasonNov 29, 2018
  3. Stefan BellerNov 29, 2018
  4. Ævar Arnfjörð BjarmasonNov 29, 2018
  5. Duy NguyenNov 29, 2018
  6. Jeff KingDec 4, 2018
  7. Derrick StoleeDec 4, 2018
  8. Jeff KingDec 4, 2018
  9. Ævar Arnfjörð BjarmasonDec 4, 2018
  10. 1/3 sha1-file: test the error behavior of alt_odb_usable()Ævar Arnfjörð Bjarmason, Dec 4, 2018
  11. sha1-file: test the error behavior of alt_odb_usable()Ævar Arnfjörð Bjarmason, Mar 28, 2019
  12. Jeff KingMar 29, 2019
  13. Ævar Arnfjörð BjarmasonMar 29, 2019
  14. Ævar Arnfjörð BjarmasonApr 8, 2019
  15. Junio C HamanoApr 9, 2019
  16. Ævar Arnfjörð BjarmasonApr 9, 2019
  17. Junio C HamanoApr 9, 2019
  18. Jeff KingApr 9, 2019
  19. Junio C HamanoApr 9, 2019
  20. 0/3 sha1-file: warn if alternate is a git repo (not object dir)Ævar Arnfjörð Bjarmason, Dec 4, 2018
  21. 2/3 sha1-file: emit error if an alternate looks like a repositoryÆvar Arnfjörð Bjarmason, Dec 4, 2018
  22. Junio C HamanoDec 5, 2018
  23. Jeff KingDec 5, 2018
  24. 3/3 sha1-file: change alternate "error:" message to "warning:"Ævar Arnfjörð Bjarmason, Dec 4, 2018
  25. Junio C HamanoDec 5, 2018
  26. Jeff KingDec 5, 2018
  27. Junio C HamanoDec 5, 2018
  28. Ævar Arnfjörð BjarmasonDec 4, 2018
  29. Derrick StoleeDec 4, 2018

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.