From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>, "taylor\,
david" <David.Taylor@dell.com>
Subject: Re: git worktrees must exist even if locked
Date: Tue, 16 May 2017 07:43:23 +0900 [thread overview]
Message-ID: <xmqqshk568s4.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <63F1AEE13FAE864586D589C671A6E18B0D6B8C@MX203CL03.corp.emc.com> (david taylor's message of "Mon, 15 May 2017 13:58:19 +0000")
"taylor, david" <David.Taylor@dell.com> writes:
> The original report was against Git v2.12.2. I have since tried v2.12.3, v2.13.0,
> and the next branch. All exhibit the same symptoms.
>
> Even if you ignore the original scenario for creating the problem, if I do a 'rm -rf' or 'mv'
> of a tree that contains within it worktrees, that should not break the use of Git with
> worktrees that live elsewhere nor commands that don't require a repository.
Duy, any ideas?
Thanks.
>
>> -----Original Message-----
>> From: taylor, david
>> Sent: Wednesday, May 10, 2017 4:25 PM
>> To: git@vger.kernel.org
>> Subject: git worktrees must exist even if locked
>>
>> The Git documentation in describing worktrees says that one reason
>> why you might want to lock a worktree is to prevent it from being pruned
>> if it is on a removable media that isn't currently mounted.
>>
>> So, my expectation was that if the worktree is inaccessible (and locked), Git
>> would pretend that there is no worktree by that name.
>>
>> In reality, if you have such a worktree, Git gets an error.
>>
>> On local systems, /home is local to a machine; home directories are
>> elsewhere.
>> Home directories are NFS mounted; /home is not.
>>
>> . create a repository in /my/home/dir/my-repo.git with
>>
>> git clone --bare <some arguments>
>>
>> . create an empty directory /home/somedir/worktree-tests
>>
>> . use 'git worktree add' to add /home/somedir/worktree-tests/<branch-
>> name>
>> as a worktree on branch <branch-name>. It gets populated with the correct
>> content.
>>
>> . lock it using'git worktree lock'
>>
>> So far, so good. Now, go to a different computer -- one on which
>> /home/somedir/worktree-tests does not exist (and therefore
>> /home/somedir/worktree-tests/<branch-name> does not exist).
>>
>> . cd /my/home/dir/my-repo.git
>>
>> Now, try issuing Git commands. Many will fail.
>>
>> git fetch ==> fails:
>>
>> fatal: Invalid path '/home/somedir/worktree-tests': No such file or directory
>>
>> git status ==> fails -- same error as above
>> git help worktree ==> fails -- same error as above
next prev parent reply other threads:[~2017-05-15 22:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-15 13:58 git worktrees must exist even if locked taylor, david
2017-05-15 22:43 ` Junio C Hamano [this message]
2017-05-29 10:17 ` Duy Nguyen
-- strict thread matches above, loose matches on Subject: below --
2017-05-10 20:24 taylor, david
2017-05-29 11:18 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqshk568s4.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=David.Taylor@dell.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).