All of lore.kernel.org
 help / color / mirror / Atom feed
* git worktrees must exist even if locked
@ 2017-05-10 20:24 taylor, david
  2017-05-29 11:18 ` Duy Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: taylor, david @ 2017-05-10 20:24 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: git worktrees must exist even if locked
@ 2017-05-15 13:58 taylor, david
  2017-05-15 22:43 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: taylor, david @ 2017-05-15 13:58 UTC (permalink / raw)
  To: git

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.

> -----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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-29 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 20:24 git worktrees must exist even if locked taylor, david
2017-05-29 11:18 ` Duy Nguyen
2017-05-15 13:58 taylor, david
2017-05-15 22:43 ` Junio C Hamano
2017-05-29 10:17   ` Duy Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.