Re: [PATCH] worktree: add: introduce the --name option
From: Duy Nguyen <hidden>
Date: 2016-07-20 14:55:44
On Tue, Jul 19, 2016 at 9:35 PM, Antoine Tenart [off-list ref] wrote:
On Tue, Jul 19, 2016 at 09:04:11PM +0200, Duy Nguyen wrote:quoted
On Tue, Jul 19, 2016 at 8:54 PM, Antoine Tenart [off-list ref] wrote:quoted
On Tue, Jul 19, 2016 at 08:23:58PM +0200, Duy Nguyen wrote:quoted
On Tue, Jul 19, 2016 at 8:04 PM, Junio C Hamano [off-list ref] wrote: 080739b (worktree.c: find_worktree() search by path suffix - 2016-06-13) from 'next' should help identify worktrees in this case by specifying 'project0/foo', 'project1/foo'... Granted it's not fun to type all that when 'project0/foo' is something long, and bash completion probably does not help much either.So with this I'll be able to create new worktrees, using paths having the same basename, but in different let's say "project directories"?Well, internal name is still out of your control, but if you want to do something to a worktree you can say "do project0/foo". With 'next' those verbs can be lock and unlock. We probably can make 'worktree list' take filter and show just one worktree (and just add "git worktree show" for that).Hmm, so if I understand correctly my use case still won't be supported, as adding a new worktree with the same basename will fail. Or did I miss something?
Hm... _what_ fails? If you create two worktrees project0/foo and project1/foo, you'll get .git/worktrees/foo and .git/worktrees/foo1 but worktree creation should succeed both times. As long as you don't have to look into .git/worktrees/ everything should be fine, you won't see foo vs foo1. If you absolutely have to, I'm thinking of "git --rev-parse --worktree=<xxx> --git-dir" (or something similar) that will give you $GIT_DIR to a specific worktree (e.g. .git/worktrees/foo or .git/worktrees/foo1). Then you can specify "git rev-parse --worktree=project0/foo --git-dir" and still don't have to see foo vs foo1. -- Duy