On Tue, Mar 26, 2013 at 08:02:30AM -0000, Philip Oakley wrote: > >> Yeah, for historical reasons GIT_WORK_TREE defaults to $(pwd) when > >> GIT_DIR is explicitly set. > > > > And it *WILL* be that way til the end of time. Unless you are at > > the top level of your working tree, you are supposed to tell where > > the top level is with GIT_WORK_TREE when you use GIT_DIR. Always. > > Should this important warning be part of the git(1) documentation on the > environment variables (and possibly other places) given the consequences > of this case? It wasn't something I'd appreciated from a simple reading. Something like this, maybe? -- 8< -- Subject: [PATCH] git.txt: document the implicit working tree setting with GIT_DIR Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- Documentation/git.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/git.txt b/Documentation/git.txt index 7efaa59..ce55abf 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -671,6 +671,8 @@ Git so take care if using Cogito etc. specifies a path to use instead of the default `.git` for the base of the repository. The '--git-dir' command-line option also sets this value. + If neither GIT_WORK_TREE nor '--work-tree' is set, the + current directory will become the working tree. 'GIT_WORK_TREE':: Set the path to the working tree. The value will not be -- 1.8.2.82.gc24b958 -- 8< -- -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html