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

Re: [RFC] Submodules in GIT

From
Andreas Ericsson <ae@op5.se>
Date
Nov 30, 2006, 18:57 UTC
Message-ID
<456F29A2.1050205@op5.se>
In-Reply-To
<20061130170625.GH18810@admingilde.org>
Martin Waitz wrote:
Show 38 quoted lines
> hoi :)
> 
> On Wed, Nov 29, 2006 at 08:00:22PM +0000, Andy Parkins wrote:
>> On Wednesday 2006, November 29 16:03, Martin Waitz wrote:
>>
>> Further, how is the supermodule index going to represent working
>> directory changes in the submodule?  The only link between the two is
>> a commit hash.  It has to be like that otherwise you haven't made a
>> supermodule-submodule, you've just made one super-repository.  Also,
>> if you don't store submodule commit hashes, then there is no way to
>> guarantee that you're going to be able get back the state of the
>> submodule again.
> 
> This is handled in the next paragraph.
> The argument really is: HEAD always points to the checked out branch,
> so it really has a relationship to the working directory.
> 
>>> Contra HEAD:
>>>  - HEAD is not garanteed to be equal to the working directory anyway,
>>>    you may have uncommitted changes.
>> That's the case for every file in a repository, so isn't really a
>> worry.  It's the equivalent of changing a file and not updating the
>> index - who cares?  As long as update-index tells you that the
>> submodule is dirty and what to do to clean it, everything is great.
> 
> Yes, it's not a real counter-argument, but it relativates the previous
> pro-argument.
> 
>>>  - when updating the supermodule, you have to take care that your
>>>    submodules are on the right branch.
>>>    You might for example have some testing-throwawy branch in one
>>>    submodule and don't want to merge it with other changes yet.
>> What is the "right" branch though?  As I said above, if you're tracking one 
>> branch in the submodule then you've effectively locked that submodule to that 
>> branch for all supermodule uses.
> 
> yes, but luckily GIT branches are very flexible.
> 

There's no real technical reason for locking it to a single branch though, and in case of a fork in the upstream submodule project, you might suddenly decide that "the other team" is heading in a much more interesting direction and you want to use their work in your module instead. Will you now have to maintain a separate branch just to keep the same name as the branch the original team used?

Show 5 quoted lines
>> Or you've made yourself a big rod to beat yourself with everytime you
>> want to do some development on an "off" branch on the submodule.
> 
> I don't think it is that bad.
> 

It could be, and as has already been stated, there's no real reason to limit this to a particular branch, so I don't see why we would want to impose such non-real restrictions.

Show 6 quoted lines
>>> Pro refs/heads/master:
>>>  - the supermodule really tracks one defined branch of development.
>> Why is this a pro?
> 
> You always know which branch in the submodule is the "upstream" branch
> which is managed by the supermodule.

No you don't. The branch-name might be moved to some other tip of the DAG, and that's exactly the same as changing the branch you're tracking.

Show 5 quoted lines
> You can easily have several topic-branches and merge updates from the
> master branch.
> otherwise you always have to remember which branch holds your current
> contents from the supermodule.
> 
No you don't. The only thing you need is the commit-sha.
> When viewed from the supermodule, you are storing one branch per
> submodule in your tree.
> 
Wrong again. You're storing one particular point in the revision history.
Show 11 quoted lines
>>>  - you can easily overwrite one submodule by changing to another branch,
>>>    without fearing that changes in the supermodule change anything
>>>    there.
>> You can always do that anyway by simply not running update-index for the 
>> submodule in the supermodule.
> 
> Suppose you are working on a complicated feature in one submodule.
> You create your own branch for that feature and work on it.
> Now you want to update your project, so you pull a new supermodule
> version. Now this pull also included one (for you unimportant) change
> in the submodule.
git reset to the rescue.
Show 9 quoted lines
> I think it is more clear to update the master branch with the new
> version coming from the supermodule, while leaving your work intact
> (you haven't commited it to the supermodule yet, so the supermodule
> should not care about your changes, it's just some dirty tree).
> Then you can freely merge between your branch and master as you like and
> are not forced to merge at once. And perhaps you even do not want to
> merge at all, because you are on an experimental branch which really is
> mutually exclusive with the current supermodule contents.
> 

This is all just policy though. Tools that enforce a certain policy are not good tools.

The only problem I'm seeing atm is that the supermodule somehow has to mark whatever commits it's using from the submodule inside the submodule repo so that they effectively become un-prunable, otherwise the supermodule may some day find itself with a history that it can't restore.

The really major problem with this is that now you'll have one repository of the submodule that is actually special, so it's not certain you can go and use any repository at all of the submodule code, since the upstream repo most likely won't be all that interested in having all of that meta-data inside it. In reality, I'm sure this will be a small problem though, as submodules that are in reality projects which the supermodule's maintainer isn't the owner of will most likely never rewind their history beyond the supermodules stored commit. It's something fsck will have to be taught to watch for though.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Martin WaitzNext: sf
Message 17 of 160 in “Re: [RFC] Submodules in GIT”
  1. Andy ParkinsNov 28, 2006
  2. Jakub NarebskiNov 28, 2006
  3. Andy ParkinsNov 28, 2006
  4. Shawn PearceNov 28, 2006
  5. Andy ParkinsNov 28, 2006
  6. Shawn PearceNov 28, 2006
  7. Jon LoeligerNov 28, 2006
  8. Martin WaitzNov 29, 2006
  9. sfNov 30, 2006
  10. Steven GrimmNov 28, 2006
  11. Shawn PearceNov 28, 2006
  12. Martin WaitzNov 29, 2006
  13. Andy ParkinsNov 29, 2006
  14. Andreas EricssonNov 30, 2006
  15. Andy ParkinsNov 30, 2006
  16. Martin WaitzNov 30, 2006
  17. Andreas EricssonNov 30, 2006
  18. sfDec 1, 2006
  19. Martin WaitzDec 1, 2006
  20. sfDec 1, 2006
  21. Martin WaitzDec 1, 2006
  22. Stephan FederDec 1, 2006
  23. Martin WaitzDec 1, 2006
  24. Stephan FederDec 1, 2006
  25. Martin WaitzDec 1, 2006
  26. Uwe Kleine-KoenigDec 5, 2006
  27. Andreas EricssonDec 5, 2006
  28. Jakub NarebskiDec 5, 2006
  29. Uwe Kleine-KoenigDec 5, 2006
  30. Andreas EricssonDec 5, 2006
  31. Sven VerdoolaegeDec 5, 2006
  32. Andy ParkinsDec 1, 2006
  33. Martin WaitzDec 1, 2006
  34. sfDec 1, 2006
  35. Martin WaitzDec 1, 2006
  36. sfDec 1, 2006
  37. Martin WaitzDec 1, 2006
  38. Andreas EricssonDec 1, 2006
  39. Martin WaitzDec 1, 2006
  40. Andreas EricssonDec 1, 2006
  41. Martin WaitzDec 1, 2006
  42. Andreas EricssonDec 1, 2006
  43. Linus TorvaldsDec 1, 2006
  44. sfDec 1, 2006
  45. Andreas EricssonDec 1, 2006
  46. Linus TorvaldsDec 1, 2006
  47. Martin WaitzDec 1, 2006
  48. Alan ChandlerDec 1, 2006
  49. Josef WeidendorferDec 1, 2006
  50. Martin WaitzDec 1, 2006
  51. Josef WeidendorferDec 1, 2006
  52. Martin WaitzDec 1, 2006
  53. Josef WeidendorferDec 1, 2006
  54. Martin WaitzDec 2, 2006
  55. Josef WeidendorferDec 3, 2006
  56. Martin WaitzDec 3, 2006
  57. Linus TorvaldsDec 1, 2006
  58. sfDec 1, 2006
  59. Josef WeidendorferDec 1, 2006
  60. Linus TorvaldsDec 1, 2006
  61. Josef WeidendorferDec 1, 2006
  62. Linus TorvaldsDec 2, 2006
  63. Andy ParkinsDec 2, 2006
  64. Josef WeidendorferDec 2, 2006
  65. Linus TorvaldsDec 2, 2006
  66. Martin WaitzDec 2, 2006
  67. Linus TorvaldsDec 2, 2006
  68. Martin WaitzDec 2, 2006
  69. Josef WeidendorferDec 3, 2006
  70. Martin WaitzDec 2, 2006
  71. Linus TorvaldsDec 2, 2006
  72. Martin WaitzDec 2, 2006
  73. Linus TorvaldsDec 2, 2006
  74. Linus TorvaldsDec 2, 2006
  75. Thoughts about memory requirements in traversals [Was: Re: [RFC] Submodules in GIT]Josef Weidendorfer, Dec 3, 2006
  76. Linus TorvaldsDec 3, 2006
  77. Shawn PearceDec 3, 2006
  78. Josef WeidendorferDec 3, 2006
  79. Jakub NarebskiDec 3, 2006
  80. Josef WeidendorferDec 3, 2006
  81. Martin WaitzDec 3, 2006
  82. sfDec 1, 2006
  83. Torgil SvenssonDec 2, 2006
  84. Linus TorvaldsDec 2, 2006
  85. Torgil SvenssonDec 3, 2006
  86. Linus TorvaldsDec 3, 2006
  87. Torgil SvenssonDec 4, 2006
  88. Linus TorvaldsDec 4, 2006
  89. Torgil SvenssonDec 4, 2006
  90. Andreas EricssonDec 5, 2006
  91. Jakub NarebskiDec 5, 2006
  92. Andreas EricssonDec 5, 2006
  93. Jakub NarebskiDec 5, 2006
  94. Andy ParkinsDec 3, 2006
  95. Daniel BarkalowDec 5, 2006
  96. sfDec 5, 2006
  97. R. Steve McKownDec 9, 2006
  98. Torgil SvenssonDec 10, 2006
  99. Torgil SvenssonDec 14, 2006
  100. Josef WeidendorferDec 14, 2006
  101. Torgil SvenssonDec 15, 2006
  102. Josef WeidendorferDec 15, 2006
  103. Torgil SvenssonDec 15, 2006
  104. Torgil SvenssonDec 16, 2006
  105. Torgil SvenssonDec 16, 2006
  106. Jakub NarebskiDec 16, 2006
  107. Torgil SvenssonDec 16, 2006
  108. Jakub NarebskiDec 16, 2006
  109. Junio C HamanoDec 16, 2006
  110. Torgil SvenssonDec 16, 2006
  111. Torgil SvenssonDec 16, 2006
  112. Jakub NarebskiDec 16, 2006
  113. Torgil SvenssonDec 17, 2006
  114. Linus TorvaldsDec 16, 2006
  115. Linus TorvaldsDec 16, 2006
  116. Torgil SvenssonDec 16, 2006
  117. Martin WaitzDec 2, 2006
  118. Josef WeidendorferDec 1, 2006
  119. Martin WaitzDec 1, 2006
  120. Linus TorvaldsDec 1, 2006
  121. Josef WeidendorferDec 2, 2006
  122. Linus TorvaldsDec 2, 2006
  123. Andy ParkinsDec 2, 2006
  124. Michael K. EdwardsDec 4, 2006
  125. Sam VilainDec 5, 2006
  126. Sven VerdoolaegeDec 3, 2006
  127. Linus TorvaldsDec 3, 2006
  128. Jakub NarebskiDec 3, 2006
  129. Josef WeidendorferDec 4, 2006
  130. sfDec 1, 2006
  131. Jon LoeligerDec 8, 2006
  132. Sven VerdoolaegeDec 8, 2006
  133. Andreas EricssonDec 12, 2006
  134. Martin WaitzDec 1, 2006
  135. Martin WaitzDec 1, 2006
  136. Andreas EricssonDec 1, 2006
  137. Martin WaitzDec 1, 2006
  138. Stephan FederDec 1, 2006
  139. Martin WaitzDec 1, 2006
  140. Stephan FederDec 1, 2006
  141. Martin WaitzDec 1, 2006
  142. Stephan FederDec 1, 2006
  143. Martin WaitzDec 1, 2006
  144. sfDec 1, 2006
  145. Martin WaitzDec 2, 2006
  146. Andy ParkinsDec 1, 2006
  147. Martin WaitzDec 1, 2006
  148. Andy ParkinsDec 1, 2006
  149. Martin WaitzDec 1, 2006
  150. Andy ParkinsDec 1, 2006
  151. Martin WaitzDec 1, 2006
  152. Andy ParkinsDec 2, 2006
  153. Josef WeidendorferDec 2, 2006
  154. Martin WaitzDec 2, 2006
  155. Josef WeidendorferDec 3, 2006
  156. Martin WaitzDec 2, 2006
  157. Jakub NarebskiDec 2, 2006
  158. Jakub NarebskiDec 2, 2006
  159. Jakub NarebskiDec 2, 2006
  160. Andy ParkinsDec 3, 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.