Subject: Re: Submodules or separate repos?

From: Jens Lehmann <[email-masked]>
Date: Mon, 25 Apr 2011 21:57:57 +0200

Am 25.04.2011 12:35, schrieb Michael Treibton:
> ive recently converted a project that was in svn to use git - and
> that's gone well.
> 
> in doing this ive been wondering if i can't split up the respository
> more.  currently we have this:
> 
> project/
>     core/
>     modules/
>         moduleA/
>         moduleB/
> 
> Which i think is fairly typical of most projects.
> 
> i was wondering how feasible it would be to split out "moduleA" and
> "moduleB" into their own repositories? to me that makes sense.

In my experience that only makes sense when one of the following
conditions is met for "moduleA" and "moduleB":

* they are developed by someone else

* they contain code shared between superprojects

* they consist of huge and/or many files that would hurt performance
  of everyday git commands.

(See https://git.wiki.kernel.org/index.php/SubprojectSupport for a
more complete discussion of submodules and other subproject
techniques)

I can't see that splitting up the repository just because you can is
buying anything - except extra overhead for everyday development. So
I think you have to have a good reason to do that (but you didn't
mention any ;).

> but by
> themselves neither "moduleA" or "moduleB" would compile without the
> core.

That rather looks like an argument against splitting them off. Even
though we have submodules depending on the presence of other
submodules at my dayjob, they almost never depend on anything in
the superproject (the only exception being a file containing a
project version which is then to be used for all build artifacts,
but that is a convention used in all our superprojects).

> And if they were separate repositories, how would this work from a
> development point of view?  what about a release of the project? would
> there be a makefile which pulled in a known version of tarball
> released from each moduleX repository?

That depends on the technique you choose. But I really can't answer
that question until you share your motivation for having separate
repositories in the first place.