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

Re: RFC: Subprojects

From
Linus Torvalds <torvalds@osdl.org>
Date
Jan 11, 2006, 20:06 UTC
Message-ID
<Pine.LNX.4.64.0601111157020.5073@g5.osdl.org>
In-Reply-To
<43C55FEF.2090108@hogyros.de>
On Wed, 11 Jan 2006, Simon Richter wrote:
Show 5 quoted lines
> 
> Exactly. The questions I posed in the last paragraph of the initial mail,
> rewritten for clarity, would be
>  - "should cg-commit automatically create a commit in the master project when
> a change in the subproject is committed?", and
No.

Don't commit in the "parent" thing automatically. The sub-project should be as independent as possible, and you should see a commit to that to be nothing more than "editing" a regular file in the top-level project.

In many ways, if you decide to look into doing a "gitlink" kind of object, that object really _does_ conceptually point to the .git/HEAD file in the subproject. So when you do a commit in the subproject, conceptually that is no different from editing the .git/HEAD.

Then, when you want to commit the _dependency_ of the top-level project on the sub-project, you commit in the top level. That commit probably does other things too: it probably also commits the code in the top level that now depends on the sub-project changes.

So don't tie the two together any more than necessary. My suggested usage case has the big advantage that the sub-project is much less tightly coupled, so you can do things like "git pull" _inside_ the subproject, to update it, and then do a big compile in the top-level project to reflect the changes (and perhaps update stuff at the top level to conform to changes in the sub-project), and then commit in the top independently (which will now automatically pick up the changes to .git/HEAD that "git pull" did on the subproject).

>  - "should cg-commit automatically commit all changes to subprojects when a
> path that has been listed on the command line contains a subproject?".

Again, I'd really suggest not. If you keep the "gitlink" really meaning the ".git/HEAD" contents of the subproject (which is a good semantic rule), then if there is any dirty state in the sub-project, it is totally irrelevant to a "git commit". Because it's dirty, it's not part of of .git/HEAD yet.

Now, obviously you should make "git status" _talk_ about the fact that the sub-project is dirty, so that the committer sees that the sub-project needs committing first (the same way "git status" now informs git commit about dirty files that haven't been updated).

(I'm saying "git" here all the time rather than cg-, because not only don't I know cogito very well, I think you want to do most of the core at the git level, and just teach cg about the new capability).

			Linus
Previous: Simon RichterNext: Junio C Hamano
Message 6 of 56 in “RFC: Subprojects”
  1. Simon RichterJan 11, 2006
  2. Johannes SchindelinJan 11, 2006
  3. Simon RichterJan 11, 2006
  4. Linus TorvaldsJan 11, 2006
  5. Simon RichterJan 11, 2006
  6. Linus TorvaldsJan 11, 2006
  7. Junio C HamanoJan 14, 2006
  8. Linus TorvaldsJan 14, 2006
  9. A Large Angry SCMJan 14, 2006
  10. Linus TorvaldsJan 14, 2006
  11. A Large Angry SCMJan 14, 2006
  12. Junio C HamanoJan 14, 2006
  13. Martin LanghoffJan 15, 2006
  14. Junio C HamanoJan 15, 2006
  15. Tom PrinceJan 15, 2006
  16. Daniel BarkalowJan 16, 2006
  17. A Large Angry SCMJan 16, 2006
  18. Daniel BarkalowJan 16, 2006
  19. A Large Angry SCMJan 16, 2006
  20. Alex RiesenJan 16, 2006
  21. Junio C HamanoJan 14, 2006
  22. Junio C HamanoJan 15, 2006
  23. Josef WeidendorferJan 16, 2006
  24. Junio C HamanoJan 16, 2006
  25. Daniel BarkalowJan 17, 2006
  26. Junio C HamanoJan 17, 2006
  27. Petr BaudisJan 17, 2006
  28. Daniel BarkalowJan 17, 2006
  29. Craig SchlenterJan 17, 2006
  30. Linus TorvaldsJan 17, 2006
  31. Daniel BarkalowJan 17, 2006
  32. Junio C HamanoJan 18, 2006
  33. Junio C HamanoJan 18, 2006
  34. Alexander LitvinovJan 18, 2006
  35. Andreas EricssonJan 18, 2006
  36. Junio C HamanoJan 18, 2006
  37. Daniel BarkalowJan 18, 2006
  38. Junio C HamanoJan 18, 2006
  39. Daniel BarkalowJan 18, 2006
  40. Petr BaudisJan 23, 2006
  41. Petr BaudisJan 23, 2006
  42. Alexander LitvinovJan 16, 2006
  43. Andreas EricssonJan 16, 2006
  44. Uwe ZeisbergerFeb 20, 2006
  45. Junio C HamanoFeb 21, 2006
  46. Alexander LitvinovJan 12, 2006
  47. Martin LanghoffJan 12, 2006
  48. Alexander LitvinovJan 12, 2006
  49. Martin LanghoffJan 12, 2006
  50. Alexander LitvinovJan 12, 2006
  51. Alex RiesenJan 12, 2006
  52. Anand KumriaJan 12, 2006
  53. Daniel BarkalowJan 12, 2006
  54. [RFC][PATCH] Cogito support for simple subprojectsPetr Baudis, Jan 15, 2006
  55. Linus TorvaldsJan 15, 2006
  56. Junio C HamanoJan 15, 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.