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

Re: `git rev-parse --is-inside-work-tree` and $GIT_WORK_TREE

From
Elliott Cable <me@ell.io>
Date
Apr 1, 2016, 00:49 UTC
Message-ID
<CAPZ477MmUCmTF+Pyn0wAHVjj3LsZ9M3-v2fPb3+vD9r+rEfwBw@mail.gmail.com>
In-Reply-To
<CACsJy8BAW0E36qKjJqvLL0ZHKdh3+7G1axt1jD46Yv3atfL7fw@mail.gmail.com>
oh, wow, this got over my head *real* fast. Okay,
1. Yeah, my `$GIT_WORK_TREE` was def. an absolute path; I typed that
example code without running it *precisely* that way (entirely my
mistake! I'm so sorry for the confusion it caused, and all that typing
you did!); if I remember correctly (not at the machine right now), I
had run `git rev-parse --show-toplevel` from a different directory,
with `$GIT_DIR` set, while trying to narrow down this bug, so it gave
me an absolute path … and then copy-pasted that path, and then
replaced my copy-paste with the original command to make the
bug-report example as concise as possible? oops. But, yeah, it fails
in the manner described above with an absolute path. (Which it looks
like you two figured out above.)
2. Re: intentions, again, it seems like you've changed your mind, but …
   >  So it is a misconfiguration if you only set GIT_WORK_TREE
without setting GIT_DIR.
   I really, really hope not! Half the usefulness of `$GIT_WORK_TREE`
existing is in that mode. In fact, that's how I found `$GIT_WORK_TREE`
documented and explained, in [this blog
post](https://git-scm.com/blog/2010/04/11/environment.html) on the Git
site. That usage seems pretty damn useful, so I do hope it's
eventually explicitly supported … (and if that's *not* going to be the
case, it should be explicitly documented in the `GIT(1)` manpage,
alongside the other documentation of the environment-variables, that
the behaviour is undefined is `$GIT_DIR` isn't set first. =)
⁓ ELLIOTTCABLE — fly safe.
  http://ell.io/tt
Previous: Duy Nguyen
Message 16 of 16 in “`git rev-parse --is-inside-work-tree` and $GIT_WORK_TREE”
  1. Elliott CableMar 29, 2016
  2. Elliott CableMar 29, 2016
  3. John KeepingMar 29, 2016
  4. Junio C HamanoMar 29, 2016
  5. Jeff KingMar 29, 2016
  6. Junio C HamanoMar 29, 2016
  7. Jeff KingMar 29, 2016
  8. Jeff KingMar 29, 2016
  9. John KeepingMar 29, 2016
  10. Jeff KingMar 29, 2016
  11. John KeepingMar 29, 2016
  12. John KeepingMar 29, 2016
  13. Jeff KingMar 29, 2016
  14. Junio C HamanoMar 29, 2016
  15. Duy NguyenMar 30, 2016
  16. Elliott CableApr 1, 2016

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.