Subject: Re: [PATCH v8 3/4] worktree add: add --orphan flag

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 19 Jan 2023 16:32:32 +0100

On Wed, Jan 18 2023, Jacob Abel wrote:

> On 23/01/14 07:09PM, Junio C Hamano wrote:
>> Jacob Abel <[email-masked]> writes:
>>
>> >> 	git worktree add --orphan -b topic main
>> >> 	git worktree add --orphan -B topic main
>> >
>> > I am hesitant to add these as they break away from the syntax used in
>> > `git switch` and `git checkout`.
>>
>> Not that I care too deeply, but doesn't it introduce end-user
>> confusion if we try to be compatible with "git checkout --orphan
>> <branch>", while allowing this to be compatible with the default
>> choice of the branch name done by "git worktree add"?  "--orphan" in
>> "git checkout" behaves similar to "-b|-B" in that it always wants a
>> name, but "git worktree add" wants to make it optional.
>
> Yes. I think it's a fairly minor degree of confusion but I agree that it adds
> potentially unneeded confusion.

I think this topic is ready to advance as-is without Phillip's upthread
suggestion (<[email-masked]>) to
allow us to combine --orphan and -b and -B.

I also think that UX suggestion is sensible, but if we do that we
shouldn't just apply that to "git worktree", but also change the the
corresponding "git switch" UX, on which this new "git worktree --orphan"
is modeled.

I don't think it's worth it to make the UX between the two inconsistent
in this regard, so if "switch" doesn't learn to do this we'd be better
off with not making "--orphan" a flag.

But if we are going to make it a flag let's have both support the same
sort of invocation.

Therefore I think this series is ready as-is without this proposed UX
change. We should first support the same sort of invocations that
"swich" already supports.

If we then want to change the UX later we should change it for both, not
leave the two inconsistent.