Subject: Re: [DONOTAPPLY PATCH 2/3] setup: warn about implicit worktree with $GIT_DIR

From: Jonathan Nieder <[email-masked]>
Date: Tue, 26 Mar 2013 13:35:23 -0700

Jeff King wrote:
> On Tue, Mar 26, 2013 at 01:21:42PM -0700, Jonathan Nieder wrote:

>> If we want this warning, would something like the following do?
>> 
>> 	warning: You have set GIT_DIR without setting GIT_WORK_TREE
>> 	hint: In this case, GIT_WORK_TREE defaults to '.'
>> 	hint: To suppress this message, set GIT_WORK_TREE='.'
>
> That can help by teaching people how GIT_DIR behaves in general.

Yes, I think it would have helped in this case.  If I understand
correctly then for a while Richard was habitually setting GIT_DIR to
mean "act on this repository" and thought the worktree was
automatically being set to the containing directory.

I think patch 3 is a bad direction to go because there will always be
old scripts that follow what used to be the recommended way to use
GIT_DIR.  In the long term a warning like this that doesn't break them
(or a fatal error that at least doesn't confuse them) might be a good
way to go.

Thanks for your thoughtful work, as always.

Jonathan