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

Re: Change set based shallow clone

From
Junio C Hamano <junkio@cox.net>
Date
Sep 8, 2006, 05:30 UTC
Message-ID
<7vac5ancvo.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<46a038f90609072054u5ec8bc46x9878a601953b2c5d@mail.gmail.com>
"Martin Langhoff" <martin.langhoff@gmail.com> writes:
Show 16 quoted lines
> On 9/8/06, Junio C Hamano <junkio@cox.net> wrote:
> ...
>> Anyway, it is a useful feature, an important operation, and
>> it involves a lot of thinking (and hard work, obviously).
>>
>> I will not think about this anymore, until I have absolutely
>> nothing else to do for a solid few days, but you probably
>> haven't read this far ;-).
>
> For when you come back, then. I agree this is rather complicated, so
> much so that I suspect that we may be barking up the wrong tree.
>
> People who want shallow clones are actually asking for a "light"
> clone, in terms of "how much do I need to download". If everyone has
> the whole commit chain (but may be missing olden blobs, and even
> trees), the problem becomes a lot easier.

No, I do not think so. You are just pushing the same problem to another layer.

Reachability through commit ancestry chain is no more special than reachability through commit-tree or tree-containment relationships. The grafts mechanism happen to treat commit ancestry more specially than others, but that is not inherent property of git [*1*]. It is only an implementation detail (and limitation -- grafts cannot express anything but commit ancestry) of the current system.

But let's touch a slightly different but related topic first. People do not ask for shallow clones. They just want faster transfer of "everything they care about". Shallow and lazy clones are implementation techniques to achieve the goal of making everything they care about appear available, typically taking advantage of the fact that people care about recent past a lot more than they do about ancient history.

Shallow clones do so by explicitly saying "sorry you told me earlier you do not care about things older than X so if you now care about things older than X please do such and such to deepen your history". What you are saying is a variant of shallow that says "NAK; commits I have but trees and blobs associated with such an old commit you have to ask me to retrieve from elsewhere". Lazy clones do so by "faulting missing objects on demand" [*2*]. That is essentially automating the "please do such and such" part. So they are all not that different.

Now, first and foremost, while I would love to have a system that gracefully operates with a "sparse" repository that lacks objects that should exist from tag/commit/tree/blob reachability point of view, it is an absolute requirement that I can tell why objects are missing from a repository when I find some are missing by running fsck-objects [*3*]. If repository is a shallow clone, not having some object may be expected, but I want to be able to tell repository corruption locally even in that case, so "assume lack of object is perhaps it was not downloaded by shallow cloning" is an unacceptable attitude, and "when you find an object missing from your repository, you can ask the server [*4*], and if the server does not have it then you know your repository is corrupt otherwise it is Ok" is a wrong answer.

I talked about the need of upload-pack protocol extension to exchange grafts information between uploader and downloader to come up with the resulting graft and update the grafts in downloaded repository after objects tranfer is done. It is needed because by having such cauterizing graft entries I can be sure that the repository is not corrupt when fsck-objects that does look at grafts says "nothing is missing". Jon talked about "fault-in on demand and leave stub objects until downloading the real thing"; those stub objects are natural extension of grafts facility but extends to trees and blobs. Either of these would allow me to validate the sparse repository locally.

Now I'll really shut up ;-).

[*1*] For example, rev-list --object knows that it needs to show the tree-containment when given only a tree object without any commit.

[*2*] You probably could write a FUSE module that mount on your .git/objects, respond to accesses to .git/objects/?? directory and files with 38-byte hexadecimal names under them by talking to other repositories over the wire. No, I am not going to do it, and I will probably not touch it even with ten-foot pole for reasons I state elsewhere in this message.

[*3*] The real fsck-objects always looks at grafts. The fictitious version of fsck-objects I am talking about here is the one that uses parents recorded on the "parent " line of commit objects, that is, the true object level reachability.

[*4*] In git, there is no inherent server vs client or upstream vs downstream relationship between repositories. You may be even fetching from many people and do not have a set upstream at all. Or you are _the_ upstream, and your notebook has the latest devevelopment history, and after pushing that latest history to your mothership repository, you may decide you do not want ancient development history on a puny notebook, and locally cauterize the history on your notebook repository and prune ancient stuff. The objects missing from the notebook repository are retrievable from your mothership repository again if/when needed and you as the user would know that (and if you are lucky you may even remember that a few months later), but git doesn't, and there is no reason for git to want to know it. If we want to do "fault-in on demand", we need to add a way to say "it is Ok for this repository to be incomplete -- objects that are missing must be completed from that repository (or those repositories)". But that's quite a special case of having a fixed upstream.

Previous: Martin LanghoffNext: Martin Langhoff
Message 14 of 99 in “Change set based shallow clone”
  1. Jon SmirlSep 7, 2006
  2. Jakub NarebskiSep 7, 2006
  3. Jon SmirlSep 7, 2006
  4. Jeff KingSep 7, 2006
  5. Jakub NarebskiSep 7, 2006
  6. Jakub NarebskiSep 7, 2006
  7. Junio C HamanoSep 7, 2006
  8. Jon SmirlSep 7, 2006
  9. Anand KumriaSep 10, 2006
  10. Andreas EricssonSep 8, 2006
  11. Junio C HamanoSep 7, 2006
  12. Jakub NarebskiSep 7, 2006
  13. Martin LanghoffSep 8, 2006
  14. Junio C HamanoSep 8, 2006
  15. Martin LanghoffSep 8, 2006
  16. Junio C HamanoSep 8, 2006
  17. A Large Angry SCMSep 8, 2006
  18. Jon SmirlSep 8, 2006
  19. Jakub NarebskiSep 8, 2006
  20. Petr BaudisSep 9, 2006
  21. Jakub NarebskiSep 9, 2006
  22. Aneesh Kumar K.VSep 8, 2006
  23. linux@horizon.comSep 8, 2006
  24. Jon SmirlSep 8, 2006
  25. Jakub NarebskiSep 8, 2006
  26. Junio C HamanoSep 8, 2006
  27. linux@horizon.comSep 8, 2006
  28. Jon SmirlSep 8, 2006
  29. Jakub NarebskiSep 8, 2006
  30. Linus TorvaldsSep 8, 2006
  31. Jon SmirlSep 8, 2006
  32. Paul MackerrasSep 8, 2006
  33. Jon SmirlSep 9, 2006
  34. Paul MackerrasSep 10, 2006
  35. Jon SmirlSep 10, 2006
  36. linux@horizon.comSep 10, 2006
  37. Jon SmirlSep 10, 2006
  38. linux@horizon.comSep 10, 2006
  39. Linus TorvaldsSep 10, 2006
  40. Jon SmirlSep 10, 2006
  41. Linus TorvaldsSep 11, 2006
  42. Paul MackerrasSep 10, 2006
  43. Linus TorvaldsSep 11, 2006
  44. Linus TorvaldsSep 11, 2006
  45. Junio C HamanoSep 11, 2006
  46. Junio C HamanoSep 11, 2006
  47. Paul MackerrasSep 11, 2006
  48. linux@horizon.comSep 11, 2006
  49. Jon SmirlSep 11, 2006
  50. Junio C HamanoSep 11, 2006
  51. Paul MackerrasSep 11, 2006
  52. Junio C HamanoSep 11, 2006
  53. Jakub NarebskiSep 12, 2006
  54. Junio C HamanoSep 12, 2006
  55. Jakub NarebskiSep 12, 2006
  56. Jakub NarebskiSep 11, 2006
  57. Junio C HamanoSep 10, 2006
  58. Shawn PearceSep 11, 2006
  59. Junio C HamanoSep 11, 2006
  60. Shawn PearceSep 11, 2006
  61. Junio C HamanoSep 11, 2006
  62. Jakub NarebskiSep 11, 2006
  63. Shawn PearceSep 11, 2006
  64. Junio C HamanoSep 11, 2006
  65. Shawn PearceSep 11, 2006
  66. Junio C HamanoSep 11, 2006
  67. Shawn PearceSep 11, 2006
  68. Jon SmirlSep 11, 2006
  69. Paul MackerrasSep 9, 2006
  70. Linus TorvaldsSep 9, 2006
  71. Junio C HamanoSep 9, 2006
  72. Paul MackerrasSep 9, 2006
  73. Linus TorvaldsSep 9, 2006
  74. Marco CostalbaSep 9, 2006
  75. Linus TorvaldsSep 9, 2006
  76. Marco CostalbaSep 9, 2006
  77. linux@horizon.comSep 9, 2006
  78. Marco CostalbaSep 9, 2006
  79. Linus TorvaldsSep 9, 2006
  80. Jeff KingSep 9, 2006
  81. Junio C HamanoSep 9, 2006
  82. Jeff KingSep 9, 2006
  83. Linus TorvaldsSep 9, 2006
  84. Jon SmirlSep 9, 2006
  85. Linus TorvaldsSep 10, 2006
  86. Junio C HamanoSep 10, 2006
  87. Marco CostalbaSep 10, 2006
  88. Junio C HamanoSep 10, 2006
  89. Marco CostalbaSep 10, 2006
  90. Marco CostalbaSep 10, 2006
  91. Junio C HamanoSep 10, 2006
  92. Marco CostalbaSep 10, 2006
  93. Junio C HamanoSep 10, 2006
  94. linux@horizon.comSep 10, 2006
  95. Marco CostalbaSep 10, 2006
  96. Paul MackerrasSep 11, 2006
  97. linux@horizon.comSep 11, 2006
  98. Jakub NarebskiSep 10, 2006
  99. Josef WeidendorferSep 10, 2006

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.