On Mar 3, 2014, at 7:24 AM, <stefan.li...@partner.bmw.de> wrote:
> I have a git superproject with 3 submodules. The submodules are cloned from
> the same URL but use different branches. Git clones the repo three times and
> I have three entries in .git/modules. Is it possible to reuse the first clone
> for the next submodule clones?
Sort of - but I don't think you'll like the side effects.
If each of the submodules are checked out on a different branch, then HEAD is
going to be different in each repository in .git/modules. So, each of the
repositories in .git/modules are unique.
You could share the objects database (see --shared or --reference) which would
dramatically reduce the size of each repo on its own, but that comes with a
side effect: because there is no communication between any of the repositories
involved in sharing objects, git-gc will happily delete an object that may be
unneeded locally, but another repository will suddenly think it's corrupt.
You could also customize the refspecs in each repository. For example, if one
of the submodules has only 'origin/contrib' checked out, then you could change
the refspec to '+refs/heads/contrib:refs/remotes/origin/contrib', which will
cause only the objects pertaining to that branch will be downloaded. This has
the most benefit when the commit graph is orphaned in some way. However, this
approach requires manual labor every time you initialize a submodule.
- Andrew Keller
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html