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

Re: Notes on Using Git with Subprojects

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 26, 2006, 20:25 UTC
Message-ID
<Pine.LNX.4.63.0609262203510.25371@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<45196628.9010107@gmail.com>
Hi,
On Tue, 26 Sep 2006, A Large Angry SCM wrote:
> 							20060926.1715
You forgot the time zone ;-)
Show 13 quoted lines
> Notes on Using Git with Subprojects
> ===================================
> Copyright (C) 2006 by Raymond S Brand
> 
> 
> Git does not have native support for subprojects and this is a good
> thing because managing subprojects is better handled by the project
> build machinery. Managing subprojects with the project build machinery
> is more flexible than the native support from an SCM and allows the use
> of different SCMs by different subprojects. However, there is a lot of
> interest in using Git for the SCM of a project with subprojects.
> 
> Git, unfortunately, does not make it easy.

After skimming your text, I imagine that it should be possible (read: easy) to write a really simple script which does what you describe, storing the relevant information about root or sub projects in the config.

However, you left out one of the most important aspects of subprojects: the ability to manage the state of the root project: you can add, update and remove subprojects.

A while ago, Junio started playing with a new object type for subprojects so that you could have tree objects containing subprojects in addition to tree objects and blobs.

Of course, the difficult thing about this is to teach all tools to behave sensibly with the new object type.

Now, your approach of having multiple clones (sharing the object pool) is more simple than Junio's approach: no need to introduce a new object type, or adapt existing tools.

Taking this a step further, how about managing the root project in this manner:

A root project is a branch containing just one special file, "root-project". This file consists of lines like these:

-- snip -- f80a17bf3da1e24ac904f9078f68c3bf935ff250 next 03adf42c988195b50e1a1935ba5fcbc39b2b029b todo -- snap --

The meaning: subdirectory "next" contains subproject "next" which is also tracked in the branch "next" of the root project. Likewise for "todo". The root project could even contain some administrative files like a Makefile, a license, README, etc.

You could even handle the update of root-project with each commit in a subproject by a hook in that subproject's .git/hooks/post-commit, so that you'd only need a script "git-checkout-root-project.sh" to initialize them all, and probably a script "git-update-root-project.sh".

Thoughts?

Ciao, Dscho

P.S.: Is it just me, or do other people also find it confusing that --shared means different things for git-init-db and git-clone? (I know I am the sinner...)

Previous: A Large Angry SCMNext: A Large Angry SCM
Message 2 of 39 in “Notes on Using Git with Subprojects”
  1. A Large Angry SCMSep 26, 2006
  2. Johannes SchindelinSep 26, 2006
  3. A Large Angry SCMSep 26, 2006
  4. Johannes SchindelinSep 26, 2006
  5. A Large Angry SCMSep 26, 2006
  6. Daniel BarkalowSep 26, 2006
  7. Shawn PearceSep 26, 2006
  8. A Large Angry SCMSep 26, 2006
  9. Martin WaitzSep 27, 2006
  10. Johannes SchindelinSep 27, 2006
  11. Martin WaitzSep 27, 2006
  12. Johannes SchindelinSep 27, 2006
  13. Sven VerdoolaegeSep 27, 2006
  14. Junio C HamanoSep 27, 2006
  15. Michael S. TsirkinSep 28, 2006
  16. Jeff KingSep 28, 2006
  17. Martin WaitzSep 27, 2006
  18. Johannes SchindelinSep 27, 2006
  19. A Large Angry SCMSep 27, 2006
  20. Johannes SchindelinSep 27, 2006
  21. Shawn PearceSep 27, 2006
  22. Rogan DawesSep 27, 2006
  23. Shawn PearceSep 28, 2006
  24. A Large Angry SCMSep 28, 2006
  25. A Large Angry SCMSep 28, 2006
  26. A Large Angry SCMSep 27, 2006
  27. Jeff KingSep 27, 2006
  28. A Large Angry SCMSep 28, 2006
  29. Jeff KingSep 28, 2006
  30. Shawn PearceSep 28, 2006
  31. Jeff KingSep 28, 2006
  32. Shawn PearceSep 28, 2006
  33. Shawn PearceSep 28, 2006
  34. Johannes SchindelinSep 28, 2006
  35. Martin WaitzSep 28, 2006
  36. A Large Angry SCMSep 28, 2006
  37. Martin WaitzSep 29, 2006
  38. A Large Angry SCMSep 26, 2006
  39. A Large Angry SCMOct 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.