Re: [long] worktree setup cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 21, 2010 at 10:30 AM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:
> Nguyen Thai Ngoc Duy wrote:
>> On Thu, Oct 21, 2010 at 2:07 AM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:
>
>>> Â- otherwise, if original cwd was under repository,
> [...]
>>> Â Â Â Â Â Â ÂGIT_WORK_TREE defaults to unset.
>>
>> What do you mean by "under repository"? If the repo is /tmp/git/.git,
>> then cwd is at /tmp/git/.git?
>
> I meant if the original cwd lies within the repository.
>
> Example:
>
> Ârepo      /tmp/git/.git
> Âstarting cwd  /tmp/git/.git/objects/pack

OK it's considered a bare repo, so no worktree.

>>> D. User-supplied relative paths.
>>>
>>> Â- path in .git file is relative to containing directory
>>> Â- path in GIT_DIR is relative to original cwd
>>> Â- paths in GIT_WORK_TREE and core.worktree are relative to
>>> Â $GIT_DIR
>>
>> I think $GIT_WORK_TREE is relative to original cwd.
>
> git.txt is confusing, then. ÂActually it has some other insights:
>
> Â--work-tree=<path>
> Â Â Â ÂSet the path to the working tree. The value
> Â Â Â Âwill not be used in combination with
> Â Â Â Ârepositories found automatically in a .git
> Â Â Â Âdirectory (i.e. $GIT_DIR is not set).
>
> So GIT_WORK_TREE should be discarded or warned about when GIT_DIR is
> not set. (?)

Yeah. Junio reminded me in another mail. It should warn (at least, me).

> Â Â Â ÂThis can also be controlled by setting the
> Â Â Â ÂGIT_WORK_TREE environment variable and the
> Â Â Â Âcore.worktree configuration variable. It can be
> Â Â Â Âan absolute path or relative path to the
> Â Â Â Âdirectory specified by --git-dir or GIT_DIR.
>
> This is where I got the impression about relative paths.

Hmm.. OK then. So worktree can be relative to gitdir, which in turn
can be relative to original cwd. Fun.

> Â Â Â ÂNote: If --git-dir or GIT_DIR are specified but
> Â Â Â Ânone of --work-tree, GIT_WORK_TREE and
> Â Â Â Âcore.worktree is specified, the current working
> Â Â Â Âdirectory is regarded as the top directory of
> Â Â Â Âyour working tree.
>
> Nice to see this case is documented.
>
>> Yes, core.worktree
>> should be relative to $GIT_DIR.
>
> Speaking of which, it is not clear to me that core.worktree should
> fall under the forbidden case discussed above. ÂIf it does, what is
> the point of making it configurable?

I was not the one who introduced core.worktree, so I can't really
tell. Maybe less keystrokes? You know, "GIT_DIR=foo.git git foo" is
shorter than "GIT_DIR=foo.git GIT_WORK_TREE=/path/to/somewhere git
foo". I tend to think that core.worktree is always effective
regardless $GIT_DIR env setting. But I was wrong.

Also the "relative to $GIT_DIR" may be confusing. If $GIT_DIR points
to a file that points to a true repo, then to which one it is
relative?
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]