From: "Duy Nguyen" <pclo...@gmail.com>
Sent: Tuesday, March 26, 2013 9:48 AM
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
environment variables (and possibly other places) given the
of this case? It wasn't something I'd appreciated from a simple
Something like this, maybe?
-- 8< --
Subject: [PATCH] git.txt: document the implicit working tree setting
Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
Documentation/git.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 7efaa59..ce55abf 100644
@@ -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.
I didn't feel this conveyed the Dire Warning effect that would be needed
to avoid the original misunderstanding.
It is easy to miss some of the potential consequences when other
priorities are pressing.
As Junio wondered, perhaps rhetorically, in a later message "Why do
these people set GIT_DIR without setting GIT_WORK_TREE in the first
"If the GIT_DIR environment variable is set then it specifies a path to
use instead of the default `.git` for the base of the repository. Note
that the current directory `.` will be used as the working
GIT_WORK_TREE, if not set elsewhere. The --git-dir command-line
option also sets the GIT_DIR environment variable."
Set the path to the working tree. The value will not be
-- 8< --
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html