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

Re: Add a "Flattened Cache" to `git --clone`?

From
Bryan Turner <bturner@atlassian.com>
Date
May 14, 2020, 22:44 UTC
Message-ID
<CAGyf7-Fvyes2AwPhqAz=GhpDb=P664DLpK+4o3-ChKyR5KmJQw@mail.gmail.com>
In-Reply-To
<CAGjfG9akT+KG-tttRWEX_ZqxrqPoY_4Ed7Pymt4DkV5Rgc1CEA@mail.gmail.com>
On Thu, May 14, 2020 at 3:05 PM Caleb Gray <hey@calebgray.com> wrote:
Show 8 quoted lines
>
> Actually those are the steps that I'm explicitly hoping can be
> skipped, both on server and client, after the first successful clone
> request transaction. The cache itself would be of the end resulting
> `.git` directory (client side)... unless I have misconceptions about
> the complexity of reproducing what ends up on the client side from the
> server side... I figured the shared library probably offers endpoints
> for the information I'd need to achieve that.

I don't know that such an approach would ever get accepted. At most it could only be a partial replica of a `.get` directory. For example, including `.git/config` or `.git/hooks` carries some heavy security considerations that make it very unlikely such a change would get accepted. When you pare down the things from the `.git` directory that can reasonably be included, I suspect you're pretty much going to be left with `.git/objects/pack/pack-<something>.pack`, and perhaps `.git/packed-refs` (although the ref negotiations the client needs to do in order to even request a pack means you're unlikely to actually _benefit_ from including `packed-refs`).

For such client-side caching, really you may be better of not trying to reinvent the wheel and instead, as others have suggested, simply use `git clone --reference` (possibly plus `--dissociate` if you don't want any long-term connection between clones) to allow `git clone` to reference all the objects you have available locally to skip most of the pack transfer. If you do this, then `git clone` can _already_ make use of local `idx` files, in addition to packs, to save work.

Bryan Turner
Previous: Junio C HamanoNext: Junio C Hamano
Message 15 of 17 in “Add a "Flattened Cache" to `git --clone`?”
  1. Caleb GrayMay 14, 2020
  2. Konstantin RyabitsevMay 14, 2020
  3. Bryan TurnerMay 14, 2020
  4. Theodore Y. Ts'oMay 14, 2020
  5. Eric SunshineMay 14, 2020
  6. Konstantin RyabitsevMay 14, 2020
  7. Junio C HamanoMay 14, 2020
  8. Konstantin RyabitsevMay 14, 2020
  9. Eric WongMay 15, 2020
  10. Konstantin RyabitsevMay 17, 2020
  11. Caleb GrayMay 14, 2020
  12. Junio C HamanoMay 14, 2020
  13. Caleb GrayMay 14, 2020
  14. Junio C HamanoMay 14, 2020
  15. Bryan TurnerMay 14, 2020
  16. Junio C HamanoMay 14, 2020
  17. Caleb GrayMay 25, 2020

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.