Re: [PATCH] worktree: add: introduce the --name option
From: Duy Nguyen <hidden>
Date: 2016-07-19 18:24:32
On Tue, Jul 19, 2016 at 8:04 PM, Junio C Hamano [off-list ref] wrote:
Antoine Tenart [off-list ref] writes:quoted
Adds a --name option allowing to specify the name of a worktree when creating it. This allows to have multiple worktrees in directories having the same name (e.g. project0/foo, project1/foo etc...). This commit keeps the previous behaviour by making it the default value, i.e. by using $(basename <path>) as the worktree name when the --name option isn't used. Two new test cases are added to ensure the --name option does not break other functionalities and is working properly. Finally, the documentation is updated to reflect this --name option addition. Signed-off-by: Antoine Tenart <redacted> ---Hmm, is this related to an earlier discussion https://public-inbox.org/git/20160625051548.95564-1-barret%40brennie.ca/ in any way, or is it an independent invention? The conclusion of that discussion thread was roughly "users shouldn't even _care_ about the name, and if they have to use name to identify the worktrees to do certain things right now, reducing the need for such 'certain things', not making it easy to give a user-defined name to a worktree, is the way to go", IIRC.
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. Note that we may need a unique name elsewhere too, e.g. refs/worktrees/xyz (even though we haven't settled on this yet). Then xyz would be more exposed to the user and an easily recognizable name would be a good thing. -- Duy