From: Junio C Hamano Date: Tue, 23 Dec 2014 19:08:48 GMT Subject: Re: [PATCH] git-new-workdir: support submodules Message-ID: In-Reply-To: <1419360673.196271.13944.nullmailer@meta> Craig Silverstein writes: > 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: `. This is a problem > because the submodule's config file has an entry like `worktree = > ../../../khan-exercises` which is relative to "" > 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/S Doesn'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?