Re: [DONOTAPPLY PATCH 2/3] setup: warn about implicit worktree with $GIT_DIR
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Mar 26, 2013, 20:35 UTC
- Message-ID
- <20130326203523.GM1414@google.com>
- In-Reply-To
- <20130326202722.GA22769@sigill.intra.peff.net>
Jeff King wrote:
> On Tue, Mar 26, 2013 at 01:21:42PM -0700, Jonathan Nieder wrote:
Show 7 quoted lines
>> 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