Re: [PATCH 05/11] completion: add test showing subpar completion for git switch --orphan
- From
Jacob Keller <jacob.keller@gmail.com>
- Date
- Apr 28, 2020, 18:45 UTC
- Message-ID
- <CA+P7+xoSdDjbSAKeCsPz97Rc=ykpuTb2pNKazsCNcau2SBquMA@mail.gmail.com>
- In-Reply-To
- <xmqqsggn32i7.fsf@gitster.c.googlers.com>
On Tue, Apr 28, 2020 at 11:10 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> > Jacob Keller <jacob.keller@gmail.com> writes: > > >> And that same "is this really helping?" reasoning applies equally to > >> the "--orphan" option. > >> > >> I dunno. > >> > > > > Fair enough, new branches based on previous branches makes sense. > > I actually do not have a strong opinion either way. I just wanted > to say that it would be good to make it consistent across "checkout > -b", "switch -c" and "checkout/switch --orphan". > > It would be nice if "checkout -B" and "switch -C" pair offered > existing branches, as the intention of using the capital letter is > clear---the user wants to overwrite an existing one. > > On the other hand, I am OK if "checkout -b", "switch -c" and > "--orphan" offered either: > > (1) nothing, as your patch does, or > > (2) all branches, except for the currently checked out one.
Why reject the currently checked out one? If the premise is: "use a current branch to build a new branch name", I don't see a reason to restrict including the current branch here as well.
Show 5 quoted lines
> > It would be preferrable if they did the same thing. > > Thanks. >
The problem I see, is that regardless, I would like to see the following:
git switch -c new-branch-name <SPACE><TAB>
complete all references for the starting point.
With this series, that's handled by just checking for "-c/-C" on the command line and enabling all references. There's no positional checks done, so every word can complete to a reference.
I don't know offhand how to add completion which depends on the position of the word we're completing, so I'd have to investigate how to make that happen.
Thanks, Jake