Re: [PATCH 2/2] worktree: provide better prefix to go back to original cwd

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

 



On Thu, Oct 7, 2010 at 9:56 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> writes:
>
>> On Thu, Oct 7, 2010 at 12:54 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>> pclouds@xxxxxxxxx writes:
>>> ...
>>> If the original cwd is inside GIT_WORK_TREE, limiting ourselves inside
>>> prefix naturally limits the operation to the subdirectory we started from
>>> (if the original cwd is at GIT_WORK_TREE, that would make it a whole-tree
>>> operation). ÂA natural extension of this idea to limit the operation to
>>> the part of the subtree of the working tree we started from is to refuse
>>> to work in the case where the original cwd is outside GIT_WORK_TREE (the
>>> current implementation of GIT_WORK_TREE may or may not correctly implement
>>> it, though---I never use it myself).
>>
>> I tend to think that as we go up to worktree's root, prefix is shorten
>> and the operation area is widen. When cwd is at worktree's, we operate
>> on full worktree. If it goes up one level higher, the operation area
>> remains full worktree (but not everything under cwd because cwd now
>> can have non-worktree directories).
>
> I have a feeling that you did not understand my /srv/git/git.git (no, it
> is not a bare repository) vs /var/tmp example.
>
> I think it makes the new semantics much less yucky if the special case is
> limited to "the working tree is a subdirectory somewhere under cwd". ÂBut
> does your patch check and notice that /var/tmp is not above the working
> tree and they are completely unrelated?
>

OK I see it now. I think my patch deals with completely unrelated
worktree/cwd just fine (both cwd-to-worktree and worktree-to-cwd
contain a few "../").

There is however a case where "git status" on separate cwd/worktree
might make sense. Suppose a master repo a/.git has two submodules
a/b/.git and a/c/.git. If user stands in a/c and want to do git-status
on all repos (let's skip how it finds out a/.git is the master repo),
it would make sense to display paths, including ones from a/b/.git,
relative to a/c (which is cwd and completely unrelated to a/b/.git).
-- 
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]