On Tue, Mar 26, 2013 at 10:04 PM, Jeff King <p...@peff.net> wrote:
>>       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 think this is a good thing to mention, but a few nits:
>   1. core.worktree is another way of setting it
>   2. This can also be overridden by --bare (at least in "next").
>   3. I think having core.bare set will also override this

Yeah, I looked back at t1510 and gave up. I think it's still true:

-- 8< --
A few rules for repo setup:

1. GIT_DIR is relative to user's cwd. --git-dir is equivalent to

2. .git file is relative to parent directory. .git file is basically
   symlink in disguise. The directory where .git file points to will
   become new git_dir.

3. core.worktree is relative to git_dir.

4. GIT_WORK_TREE is relative to user's cwd. --work-tree is
   equivalent to GIT_WORK_TREE.

5. GIT_WORK_TREE/core.worktree was originally meant to work only if
   GIT_DIR is set, but earlier git didn't enforce it, and some scripts
   depend on the implementation that happened to first discover .git by
   going up from the users $cwd and then using the specified working tree
   that may or may not have any relation to where .git was found in.  This
   historical behaviour must be kept.

6. Effective GIT_WORK_TREE overrides core.worktree and core.bare

7. Effective core.worktree conflicts with core.bare

8. If GIT_DIR is set but neither worktree nor bare setting is given,
   original cwd becomes worktree.
-- 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

Reply via email to