Re: [RFC] Submodules in GIT
- From
Martin Waitz <tali@admingilde.org>
- Date
- Nov 29, 2006, 16:03 UTC
- Message-ID
- <20061129160355.GF18810@admingilde.org>
- In-Reply-To
- <200611281335.38728.andyparkins@gmail.com>
hoi :)
On Tue, Nov 28, 2006 at 01:35:37PM +0000, Andy Parkins wrote:
> The reason I thought it would have to be HEAD at all times, is to prevent > situations where the supermodule commit doesn't reflect the state of the > current tree.
The way I wanted to address this is to show in the supermodule git-status that the submodule is using another branch. That way you are warned and can decide not to commit the supermodule.
I implemented tracking of refs/heads/master (not HEAD) without much thinking, and only recently began to think about possible problems with this approach.
But I think it is an important design decision to take, so I'd like to have consensus here.
Pro HEAD: - update-index on submodule really updates the supermodule index with a commit that resembles the working directory. Contra HEAD: - HEAD is not garanteed to be equal to the working directory anyway, you may have uncommitted changes. - when updating the supermodule, you have to take care that your submodules are on the right branch. You might for example have some testing-throwawy branch in one submodule and don't want to merge it with other changes yet.
Pro refs/heads/master: - the supermodule really tracks one defined branch of development. - you can easily overwrite one submodule by changing to another branch, without fearing that changes in the supermodule change anything there. Contra refs/heads/master: - after updating the supermodule, you may not have the correct working directory checked out everywhere, because some submodules may be on a different branch. - there is one branch in the submodule which is special to all the other.
I think that most of the disadvantages of refs/heads/master can be solved by printing the above-mentioned warning in git-status when the submodule is using another branch (similiar to the planned-but-not-implemented warn if the submodule has uncommited changes).
I don't yet know how to cope with tracking HEAD directly, so I'm still in favor of tracking refs/heads/master, as already implemented.
-- Martin Waitz