setup: stop ignoring GIT_WORK_TREE (when GIT_DIR is unset)
Get series with b4
b4 am 20110119123732.GA23222@burratinoVersions newest first
- v1 Latest2 of 3 patches 17 repliesIn review
2 of 3 patches are in this archive. The cover letter announces 3.
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | tests: cosmetic improvements to the repo-setup testt/ | +50 | 0 replies | |
| 3/3 | setup: always honor GIT_WORK_TREE and core.worktreesetup.c t/ | +134 | 16 replies |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Jonathan Nieder |
|---|---|
| 1/3 | |
| 3/3 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH/RFC 0/3] setup: stop ignoring GIT_WORK_TREE (when GIT_DIR is unset)
Quoted 7 lines · Junio C Hamano
Quoted 5 lines · Jonathan Nieder
+++
b/setup.c(quoted diff) +0
-0@@ -419,6 +419,11 @@ static const char *setup_discovered_git_dir(const char *gitdir, return NULL; }
Quoted 8 lines
Review static const char *setup_discovered_git_dir(const char *gitdir, · line 426
Quoted 5 lines
(quoted diff) +5
-0+ 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 misconfiguration
After 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(-)