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

Re: Notes on Using Git with Subprojects

From
Shawn Pearce <spearce@spearce.org>
Date
Sep 27, 2006, 23:36 UTC
Message-ID
<20060927233639.GE21839@spearce.org>
In-Reply-To
<Pine.LNX.4.63.0609280113490.14200@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 5 quoted lines
> On Wed, 27 Sep 2006, A Large Angry SCM wrote:
> > Wouldn't an fsck in the parent complain about missing objects?
> 
> ... not if my original idea (which I might have forgotten to mention ;-) 
> was implemented: symlinking subproject/.git/objects to .git/objects.

Right. Which is one of the truely wonderful things about symlinks in .git/refs and symlinking .git/objects. :-)

I don't know about anyone else but this thread has certainly helped me rationalize a few thoughts about "subproject" support.

The major things I've taken away from it are:
 - Subprojects of any reasonable SCM should be supported.
   Although this is Git we sometimes want to play nice with other
   people working in the same pond.  We have a historical track
   record of doing this when it makes sense (git-svn, git-cvsserver,
   etc.) but clearly doing it for every SCM out there is not
   possible.
   But that said having "out of the box" support for Git subprojects
   within a larger Git project should Just Work.  It doesn't
   really yet.
 - Higher level projects should drive subprojects.
   Higher level projects tend to be composed of specific revisions or
   specific generations of subprojects.
   Part of the content of the higher level project is just what
   those subproject specifications are and how those subprojects
   should appear in a working directory.
 - Git Porcelain should help the user.
   Git operations should translate down through lower level projects
   when possible, and lower level project changes should push up
   when possible.
   E.g. git-fetch in a higher level repository should percolate
   down into the lower level repositories automatically.  Ditto with
   git-checkout and probably git-push.  git-commit in a lower level
   repository probably should update the specification file(s)
   in the higher level repository but not commit the higher level
   repository.
 - The subproject SCM interface needs to be modular.
   Users need to include many different subprojects and not all of
   them use Git.  Ideally Git would be able to at least be easily
   taught by the user how to invoke a particular subproject's SCM
   for the purpose of an initial checkout, if not for additional
   operations such as pull, push, commit and tag.

I used the term "generation of subprojects" as not everyone wants to bind their root project to a specific revision of a subproject. Indeed that may not be entirely practical. Instead just a particular lineage of development (e.g. "Version 1.0" vs. "Version 1.2") may be all that is needed.

For example including a CVS hosted subproject into a larger Git project means you can't use a specific SHA1 to reference a single version of that CVS subproject. Yet you can use a CVS branch or label name. But both of those are moving targets in a CVS repository. But in a sane CVS project a label or a branch will be relatively stable over time, meaning that its good enough given that its all we got (without importing everything into Git anyway).

Likewise a Git project including a Git subproject should be able to reference a named tag of the subproject. If the subproject changes its tag and the fetcher agrees to the change (with a --force) then its OK for the subproject to follow that tag change. Likewise it should be acceptable for a subproject to reference a specific branch head. Although this is a moving target that may be acceptable while the higher level project is under rapid development.

However an annoted tag probably should not be able to be created on the higher level project unless all lower-level subprojects are referenced by tags (or the equivilant) in their SCM. Which implies using a "stable tag" in CVS, a "/tags/foo@rev" in SVN, or an annotated tag in Git and updating the specification file(s) to reflect that.

-- 
Shawn.
Previous: Johannes SchindelinNext: Rogan Dawes
Message 21 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.