Re: [PATCH] Solve git-submodule issues with detached work trees
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 23, 2012, 23:42 UTC
- Message-ID
- <7veho2hwom.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <500DDB99.80103@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
> Not inside the submodule, me thinks they only make sense in the > superproject (that's why we clean the environment before working > inside the submodule).
Yes, that is fundamental and the only sane behaviour that comes from what submodules are. They are free-standing projects. Not clearing these environments when Git recurses into submodule was simply a bug (the original bug was that we added recursion without thinking these things through).
Hence...
> But setting the superproject's GIT_WORK_TREE > to something else won't work for an already initialized submodule,
... if you point the _root_ of the toplevel superproject with GIT_WORK_TREE (and the repository of the superproject with GIT_DIR), and chdir into one of its submodule's working tree, we shouldn't say $GIT_WORK_TREE/$smpath is the submodule world. That will make it impossible to work only on submodules by setting GIT_WORK_TREE to point at its root level (and the submodule repository with GIT_DIR).