[PATCH/RFC 0/3] setup: stop ignoring GIT_WORK_TREE (when GIT_DIR is unset)
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jan 19, 2011, 12:37 UTC
- Message-ID
- <20110119123732.GA23222@burratino>
- In-Reply-To
- <7v1v4aknij.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
Show 13 quoted lines
>> +++ b/setup.c
>> @@ -419,6 +419,11 @@ static const char *setup_discovered_git_dir(const char *gitdir,
>> return NULL;
>> }
>>
>> + if (getenv(GIT_WORK_TREE_ENVIRONMENT)) {
>> + warning("GIT_WORK_TREE without explicit GIT_DIR is deprecated");
>> + return setup_explicit_git_dir(gitdir, cwd, offset, nongit_ok);
>> + }
>> +
>
> My knee-jerk reaction is that calling this "deprecated" is probably
> confusing. git merely failed to notice misconfigurationAfter staring at test results, I agree. The rule, before nd/setup, seems to be something like this:
- if GIT_DIR is set, you're safe - if GIT_DIR is unset and .git is in the current directory, GIT_WORK_TREE will work by accident - otherwise, git errors out.
The patch below should be more robust. It prints a warning:
warning: pretending GIT_DIR was supplied alongside GIT_WORK_TREE
As the night winds on I am less sure that that warning is a good idea. The .git discovery behavior seems relatively safe. What is more worrisome for the future of the use of GIT_WORK_TREE independent of cwd is the interaction with pathspecs.
Jonathan Nieder (3): tests: cosmetic improvements to the repo-setup test tests: make the setup tests briefer setup: stop ignoring GIT_WORK_TREE and core.worktree
setup.c | 27 +- t/t1510-repo-setup.sh | 5166 +++++++------------------------------------------ 2 files changed, 729 insertions(+), 4464 deletions(-)