Would GIT submodules be a good idea?
doob at me.com
Mon Aug 15 23:54:16 PDT 2011
On 2011-08-16 03:37, Jesse Phillips wrote:
> 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.
I'm not exactly sure what you mean with "one source base", because
currently all OS specific stuff are in one repository.
> 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.
The problem is that you also always need the "base" repository. Which
contains implementations of the some Java classes and other utility
functions used by dwt.
> 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)?
Currently everything is in one repository but it's in separate top level
directories. Having all the OS's merge in the same directory would be
very very bad. First, it's just too much code for that. Second it's not
how SWT is arranged and it would be very difficult to port future
versions of SWT.
That was why I thought submodules could take the best of both
approaches, that is, one repository for everything (like we have now)
versus individual repositories for each project.
> 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.
I think I need to read more about submodules. What I was hoping for was
that you could have individual repositories for each project and then a
super project. When the super project could contain the build script and
when it's cloned the sub respiratory will be cloned as well.
More information about the Digitalmars-d-dwt