Would GIT submodules be a good idea?
jessekphillips+d at gmail.com
Mon Aug 15 18:37:26 PDT 2011
On Mon, 15 Aug 2011 19:26:57 +0200, Jacob Carlborg wrote:
> Since it seems that everyone is ok with git I will move the DWT2
> repository to github. That leads to the next question: Would git
> submodules be a good idea? I haven't use submodules myself my it sounds
> good in theory. I'm thinking about having sub repository for basically
> every top level directory in the current repository. One repsository for
> jface, one for dwt-win, one for dwt-linux and so on. What do you think?
My experience with submodules has been great. There is a little bit of
overhead which I'll explain below, but cloning just becomes
$ git clone url
$ git submodule init
$ git submodule update
(I of course don't know hg-git's support for this)
I'd recommend separate repositories, I guess it isn't feasible to support
all the OS specific stuff under one source base? I'd think that would be
easier than supporting D1/D2/Phobos/Tango in one source tree.
But do you really need submodules? If you want dwt you'll either pull in
dtw-win dwt-linux as a submodule of your own or just dwt-linux and jface.
Personally I think the OS's should be brought together and the library/
language separation should be their own repos (jface its own repo). In
fact if that sounds reasonable I'll volunteer to try and make it happen
(as you've done dwt-mac you might know this is a bad idea)?
Back to submodules. These create clones of a completely different repo in
a subdirectory of the project. The commit hash is stored in the parent,
not the files. You can commit/branch/push/pull/merge in your submodules
just like any other local repository. As long as your working directory
is within the submodule directory.
The .gitsubmodules config file is tracked in the repository just like any
other file. This file stores the information about the repository
locations and directories to use. The first time setup can be done from
the command line but say for example someone forks dwt-linux and jface.
Assuming we are using a Hub project (or whatever the formal name would
be). There is DWT which has submodules of jface, dwt-linux... If the user
wants to have their own for of DWT that points to their forks of jface...
they would need edit the .gitsubmodules so that the URL locations point
to their git repositories.
$ git submodule init just takes the information found in the
configuration file and moves them into .git/config So once
the .gitsubmodules is updated you'll have easy checkout.
I don't think a Hub project is needed.
More information about the Digitalmars-d-dwt