Subject: Re: Notes on Using Git with Subprojects

From: A Large Angry SCM <[email-masked]>
Date: Tue, 26 Sep 2006 15:33:49 -0700

Shawn Pearce wrote:
> Daniel Barkalow <[email-masked]> wrote:
[...]
> I agree entirely.
> 
> I have about 30 "subprojects" tacked into one large Git repository
> for this exact reason.  In at least 5 of these cases they shouldn't
> be sharing a Git repository as by all rights they are different
> projects.
> 
> What I'm doing is sort of like tacking both the Linux kernel and
> glibc into the same Git repository because you might need to change
> and bisect over updates to the system call layer.  Insane, yes.
> Probably shouldn't be done; but right now that interface layer
> between several subprojects is still in flux and it makes it rather
> easy to keep everything in sync.
> 
> Its annoying to perform commits to the "root project" every time the
> subproject changes.  And it brings some complexity when you want to
> talk about merging that root project.  But if its automated as part
> of "git commit" and "git merge" (either directly in those tools or
> by hooks users can install) then its probbaly a non issue.

So, for each subproject of a parent project, you want to record branch, 
version (commit ID), and directory location. Not quite as easy to do in 
a makefile but do-able.

An operation that _needs_ to change more than one project's versioned 
state a time should be rare. If you have to do it often, then instead of 
subprojects you probably have a partitioning of one project. A 
subproject should be independent of its parent projects. A merge of a 
parent project should not affect a subproject other than to pick a 
particular subproject version.

Your example of the kernel and glibc is an example of sibling projects. 
Each one in independent and (some) versions of each project should work 
(better or worse) with the other. The root project here shouldn't really 
do more than specify which version of the kernel and glibc to use.