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

Re: [RFC] Submodules in GIT

From
Martin Waitz <tali@admingilde.org>
Date
Dec 1, 2006, 11:31 UTC
Message-ID
<20061201113103.GM18810@admingilde.org>
In-Reply-To
<200612011029.28059.andyparkins@gmail.com>
hoi :)
On Fri, Dec 01, 2006 at 10:29:26AM +0000, Andy Parkins wrote:
Show 11 quoted lines
> On Friday 2006 December 01 09:57, Martin Waitz wrote:
> 
> > So why do you need the url hint committed to the supermodule?
> > We don't store remote information in the object database, too.
> 
> That's why it was a hint, probably configured when you first create the 
> submodule connection.
> 
> In truth, the clone will be perfectly able to get the submodule
> objects from the upstream supermodule, maintaining the distributed
> nature easily.

that's exactly the reason why the hint is not needed. Althogh you need to have one common project object database, storing the objects of all modules.

Show 9 quoted lines
> > > I say:
> > >  submodulecommithash points at a commit /in the submodule/
> >
> > But unluckily, this does not work.
> 
> Eh?  "Not work", we're talking about code that doesn't even exist, of
> course it doesn't "work".   Do you mean "doesn't work if we're using
> my implementation of submodules"?  Well that hardly seems like a fair
> attack.

Well, at first I started exactly as you described: only store the submodule commit sha1 in the parent somewhere, but don't traverse it. So this is a fair attack: your implementation already exists in http://git.admingilde.org/tali/git.git/module ;-) (ok, yes, it really is different to what you described as I stored the sha1 differently, but I really learned that it is important to be able to traverse the entire commit chain, from the root of the project to the deepest submodule.)

Show 7 quoted lines
> > You really have to be able to traverse the entire commit chain
> > from the supermodule into all submodules.
> 
> You can: when you hit a submodule tree object you set GIT_DIR to that
> submodule and continue.  If you don't do it like that then you have
> stored submodule trees in the supermodule and it's no longer a
> separate repository.

Well, a submodule repository _is_ special in some ways: fsck and prune have to take the references from the supermodule into account. In this sense it is _not_ separate from the supermodule.

I think that is important for the submodule repository to be independent in other ways than its object database: you should be able to exchange commits with other repositories (be they stand-alone or a submodule in another supermodule). You should be able to use log/diff/blame/whatever inside the submodule.

All this does not need an object database of its own. So I chose to do it the easy way and use one object database for the entire project - and disallow git-prune in a submodule. There may be other/better ways to do this, but you have to be able to access all objects which belong the project inside the toplevel project repository.

> Why you'd want to - I have no idea.  What
> purpose would you have for traversing the commit chain into the
> submodules?  The commit in the submodule is just a note of where that
> submodule was during the supermodule commit in question.
Things get much simpler if you have one big graph of objects.

clone and especially fetch/pull naturally work at once. You can ask for all objects inside the whole project which are needed to be transferred between project version A and B, including all submodules.

You can even have one bare repository for the whole project.
> I notice though that you avoided my question: what does YOUR submodule
> object contain?  I really do want to know, as there is obviously a
> fundamental difference in what I think a submodule does and what you
> (and maybe everybody else) thinks a submodule does.

It really only stores the commit of the submodule directly. So there is no new submodule object type. The parent has a direct link to the submodule commit in his tree object and in its index. In order to separate them from normal files or normal subdirectories, they get a special mode: they are represented as socket.

-- 
Martin Waitz
Previous: Martin WaitzNext: Andy Parkins
Message 76 of 82 in “Re: [RFC] Submodules in GIT”
  1. Jakub NarebskiNov 20, 2006
  2. Martin WaitzNov 20, 2006
  3. Junio C HamanoNov 20, 2006
  4. Jakub NarebskiNov 20, 2006
  5. Martin WaitzNov 20, 2006
  6. Sam VilainNov 21, 2006
  7. Linus TorvaldsNov 20, 2006
  8. J. Bruce FieldsNov 20, 2006
  9. Martin WaitzNov 20, 2006
  10. J. Bruce FieldsNov 21, 2006
  11. Martin WaitzNov 21, 2006
  12. Martin WaitzNov 20, 2006
  13. Junio C HamanoNov 21, 2006
  14. Jakub NarebskiNov 21, 2006
  15. Martin WaitzNov 21, 2006
  16. Jakub NarebskiNov 21, 2006
  17. Martin WaitzNov 21, 2006
  18. Martin WaitzNov 21, 2006
  19. Junio C HamanoNov 21, 2006
  20. Martin WaitzNov 21, 2006
  21. Yann DirsonNov 21, 2006
  22. Linus TorvaldsNov 21, 2006
  23. Linus TorvaldsNov 21, 2006
  24. Yann DirsonNov 21, 2006
  25. Shawn PearceNov 22, 2006
  26. Yann DirsonNov 23, 2006
  27. Shawn PearceNov 25, 2006
  28. Yann DirsonNov 25, 2006
  29. Linus TorvaldsNov 25, 2006
  30. Steven GrimmNov 25, 2006
  31. Linus TorvaldsNov 25, 2006
  32. Yann DirsonNov 25, 2006
  33. Sven VerdoolaegeNov 26, 2006
  34. Yann DirsonNov 26, 2006
  35. Linus TorvaldsNov 26, 2006
  36. Daniel BarkalowNov 26, 2006
  37. Andreas EricssonNov 28, 2006
  38. Daniel BarkalowNov 28, 2006
  39. Sven VerdoolaegeNov 28, 2006
  40. Daniel BarkalowNov 28, 2006
  41. Sven VerdoolaegeNov 28, 2006
  42. Daniel BarkalowNov 28, 2006
  43. Shawn PearceNov 28, 2006
  44. Daniel BarkalowNov 28, 2006
  45. Linus TorvaldsNov 28, 2006
  46. Stephan FederNov 30, 2006
  47. Andy ParkinsNov 30, 2006
  48. Sven VerdoolaegeNov 30, 2006
  49. Andy ParkinsNov 30, 2006
  50. Andreas EricssonNov 30, 2006
  51. Andy ParkinsNov 30, 2006
  52. Sven VerdoolaegeNov 30, 2006
  53. Andy ParkinsDec 1, 2006
  54. Jakub NarebskiDec 1, 2006
  55. Sven VerdoolaegeDec 1, 2006
  56. Andy ParkinsDec 1, 2006
  57. Martin WaitzNov 30, 2006
  58. sfNov 30, 2006
  59. sfNov 30, 2006
  60. Andy ParkinsDec 1, 2006
  61. Martin WaitzDec 1, 2006
  62. Andy ParkinsDec 1, 2006
  63. Sven VerdoolaegeDec 1, 2006
  64. Andy ParkinsDec 1, 2006
  65. Sven VerdoolaegeDec 1, 2006
  66. sfDec 1, 2006
  67. Andy ParkinsDec 1, 2006
  68. Martin WaitzDec 1, 2006
  69. Andy ParkinsDec 1, 2006
  70. Martin WaitzDec 1, 2006
  71. Martin WaitzDec 1, 2006
  72. Andy ParkinsDec 1, 2006
  73. Martin WaitzDec 1, 2006
  74. Andy ParkinsDec 1, 2006
  75. Martin WaitzDec 1, 2006
  76. Martin WaitzDec 1, 2006
  77. Andy ParkinsDec 1, 2006
  78. Martin WaitzDec 1, 2006
  79. Jakub NarebskiDec 2, 2006
  80. Andy ParkinsDec 1, 2006
  81. Andreas EricssonDec 1, 2006
  82. Andy ParkinsDec 1, 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.