[m-dev.] git submodules

Ben Schmidt benjamin.schmidt at alumni.unimelb.edu.au
Thu Oct 23 16:46:31 AEDT 2014


It strikes me that if you want to modify the sources, a submodule is not
a good idea, and a good old-fashioned vendor branch is smarter. It's
more integrated with your main repository, and your changes to the
upstream sources can be automatically merged. With a submodule, you've
got an unnecessary layer of indirection: first you have to make a
repository that contains the upstream repository in a vendor branch,
plus your changes, and then you have to import that submodule into your
main project. Might as well just put the vendor branch in your main
project.

That said, I know little about Git. Full disclosure: I don't like it
(always sad to see good projects such as Mercury move to it;
fortunately, with a plugin, Mercurial can use Git repositories). Thus my
comments may be more appropriate to Mercurial subrepositories than Git
submodules (which are similar, but of course not the same).

Ben.



On 23/10/14 2:48 PM, Paul Bone wrote:
> Hi.
>
> The Mercury programming langauge uses BDW GC.  We've made a few changes to
> the GC and so we build it in the Mercury tree, libatomic_ops also.
>
> I'm about to upgrade Mercury to use BDWGC 7.4.2 (from 7.2) and this is an
> opportunity to change the way we track the GC's changes as it's the first
> upgrade since we started using git (from CVS).
>
> I'm considering using git submodules to import the GC's sources into
> Mercury's build tree:
>
>      mercury/
>      mercury/boehm_gc
>      mercury/boehm_gc/libatomic_ops
>
> And if I import the gc's sources this way it would be convenient for the GC
> to import libatomic_ops sources in a similar way.  I don't know if this is
> useful or desirable for anyone else but I thought I'd ask because it will
> change what I do next.
>
> I've submitted a pull request that adds libatomic_opts as a submodule.
> After checking out the collector's sources you can issue "git submodule
> update --init" to import libatomic_ops.  Git will look for the
> libatomic_opts repository at location relative to the "origin" repository of
> ../libatomic_opts.git  (I think, I'm still learning how to use submodules.)
>
> https://github.com/ivmai/bdwgc/pull/61
>
> Thanks.
>
>



More information about the developers mailing list