Re: [PATCH] git-new-workdir: support submodules
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 23, 2014, 19:08 UTC
- Message-ID
- <xmqqzjae18vz.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1419360673.196271.13944.nullmailer@meta>
Craig Silverstein <csilvers.mail@gmail.com> writes:
Show 11 quoted lines
> The basic problem with submodules, from git-new-workdir's point of > view, is that instead of having a .git directory, they have a .git > file with contents `gitdir: <some other path>`. This is a problem > because the submodule's config file has an entry like `worktree = > ../../../khan-exercises` which is relative to "<some other path>" > rather than to "submodule_dir/.git". > > As a result, if we want the new workdir to work properly, it needs to > keep the same directory structure as the original repository: it > should also contain a .git file with a 'gitdir', and the actual .git > contents should be in the place mentioned therein.
Hmmmm, does that mean that the submodule S in the original repository O's working tree and its checkout in the secondary working tree W created from O using git-new-workdir share the same repository location? More specifically:
O/.git/ - original repository
O/.git/index - worktree state in O
O/S - submodule S's checkout in O
O/S/.git - a gitfile pointing to O/.git/modules/S
O/.git/modules/S - submodule S's repository contents
O/.git/modules/S/config - submodule S's config W/.git/ - secondary working tree
W/.git/config - symlink to O/.git/config
W/.git/index - worktree state in W (independent of O)
W/S - submodule S's checkout in W (independent of O)
W/S/.git - a gitfile pointing to O/.git/modules/SDoesn't a submodule checkout keep some state tied to the working tree in its repository configuration file? Wouldn't this change introduce problems by sharing O/.git/modules/S/config between the two checkouts?