From: "Lauri Alanko" <la@iki.fi>
To: git@vger.kernel.org
Subject: Re: A design for subrepositories
Date: Sun, 14 Oct 2012 00:23:04 +0300 [thread overview]
Message-ID: <20121014002304.14167k2j2ctspiuw.lealanko@webmail.helsinki.fi> (raw)
In-Reply-To: <7vd30m2sbr.fsf@alter.siamese.dyndns.org>
Quoting "Junio C Hamano" <gitster@pobox.com>:
> Now
> the subdirectory repositories are bound as submodules of the top
> level directory just fine.
This is indeed possible, but with some serious caveats.
Firstly, if you simply do "git submodule add ./foo" (the obligatory
"./" being quite an unobvious pitfall), you get something quite
fragile, since now we have submodule.foo.url = ./foo. If the
submodules ever get reorganized and foo is moved to ./bar, then it is
impossible to check out older versions or alternate branches, since
the submodule is no longer where it is expected to be at the origin.
A more robust solution is to use submodule.foo.url =
./.git/modules/foo, since logical name of a module doesn't change.
This seems quite kludgy, though, and this cannot be how git-submodule
is supposed to be used.
But still, "git submodule update" only looks at the modules in the
currently checked-out tree. If we have other branches or old tags that
refer to other submodules, there's no simple way to fetch those, too.
And there is not even such a concept as a bare repository with modules.
So git-submodule is fundamentally a tool to attach repositories into a
tree, not to attach repositories into a repository. That's why it's
not really fit for my purposes.
The core problem is that to clone an entire repository and all its
submodules, there needs to be a way to list them all remotely. But the
git protocol doesn't just allow us to list the subdirectories under
.git/modules. Still, there are several ways to do this:
* Just read .gitmodules in every ref and find by brute force every
submodule referred to even by a single ref. This doesn't really scale.
* Maintain a list of all the submodules in a repository. This would
have to be in a separate metadata branch, and would get rather hairy
when we need to merge from a remote that has added other submodules.
* Represent the submodules as refs instead of independent
repositories. This is my proposal for subrepositories.
However, I feel that all of these are too drastic changes to make in
git-submodule, given that it is already well-established.
The minor problems, like lack of active branch tracking and multiple
mount points of a module, could in principle be fixed in
git-submodule. But again, I have no fondness for complex shell
programming. Perhaps it was justified when the only interface to git's
functionality were the command-line tools, but nowadays there are
various ways to manipulate git repositories from real programming
languages through real libraries (libgit2, dulwich, etc), and I prefer
to use those, so I don't really have any motivation to touch
git-submodule.
Lauri
next prev parent reply other threads:[~2012-10-13 21:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-13 13:33 A design for subrepositories Lauri Alanko
2012-10-13 17:30 ` Junio C Hamano
2012-10-13 21:23 ` Lauri Alanko [this message]
2012-10-14 4:36 ` Junio C Hamano
2012-10-14 10:19 ` Lauri Alanko
2012-10-14 13:28 ` Jens Lehmann
2012-10-14 15:27 ` Lauri Alanko
2012-10-14 16:10 ` Jens Lehmann
2012-10-14 16:15 ` Jens Lehmann
2012-10-14 16:25 ` Jens Lehmann
2012-10-14 18:04 ` Junio C Hamano
2012-10-14 19:32 ` Jens Lehmann
2012-10-19 0:31 ` A design for distributed submodules Lauri Alanko
2012-10-19 20:09 ` Jens Lehmann
2012-10-14 22:59 ` A design for subrepositories Lauri Alanko
2012-10-15 17:10 ` Jens Lehmann
2012-10-13 21:20 ` perryh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121014002304.14167k2j2ctspiuw.lealanko@webmail.helsinki.fi \
--to=la@iki.fi \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).