git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git submodule vs GIT_WORK_TREE

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 26, 2012, 16:07 UTC
Message-ID
<7vobo6cazk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAD77+gTVLsEOgWo+WDafzNOYOwSZQ2KkgBuibBXemVmGu_Fzgw@mail.gmail.com>
Richard Hartmann <richih.mailinglist@gmail.com> writes:
Show 6 quoted lines
> As you are most likely aware, `git submodule` allows you to access a
> separate git repository in a sub-directory, e.g. $submodule, while
> $GIT_WORK_TREE forces git to operate in a specific directory. Combine
> the two and the result is less than ideal. git is forced to operate in
> $GIT_WORK_TREE while it should operate on $GIT_WORK_TREE/$submodule,
> instead.
The end user should not be asked to anything special.

When the user exports GIT_WORK_TREE to tell git that the root of the working tree the user wants to work on resides there (which is needed when the user exports GIT_DIR to tell git that the user wants to work on that repository), that wish obviously applies only to that repository. If git decides to visit the working tree of a different repository (e.g. a checkout of a submodule bound to the project GIT_WORK_TREE points at), even if it is done in response to the user action (e.g. like passing "--recurse-submodules" option), it should adjust GIT_WORK_TREE and GIT_DIR to be appropriate for operations in the submodule repository while doing so. If the more recent "recursive" behaviour forgets to do so, it simply is a bug.

Previous: Richard HartmannNext: Jens Lehmann
Message 2 of 13 in “git submodule vs GIT_WORK_TREE”
  1. Richard HartmannJun 26, 2012
  2. Junio C HamanoJun 26, 2012
  3. Jens LehmannJun 26, 2012
  4. Junio C HamanoJun 26, 2012
  5. Jens LehmannJun 26, 2012
  6. Junio C HamanoJun 26, 2012
  7. Richard HartmannJun 29, 2012
  8. Junio C HamanoJun 29, 2012
  9. Junio C HamanoJun 29, 2012
  10. Junio C HamanoJun 29, 2012
  11. Richard HartmannJul 1, 2012
  12. Junio C HamanoJul 2, 2012
  13. Richard HartmannJun 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.