Re: [PATCH v2] completion: optionally disable checkout DWIM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/21, Jeff King wrote:
> 
> When we complete branch names for "git checkout", we also
> complete remote branch names that could trigger the DWIM
> behavior. Depending on your workflow and project, this can
> be either convenient or annoying.
> 
> For instance, my clone of gitster.git contains 74 local
> "jk/*" branches, but origin contains another 147. When I
> want to checkout a local branch but can't quite remember the
> name, tab completion shows me 251 entries. And worse, for a
> topic that has been picked up for pu, the upstream branch
> name is likely to be similar to mine, leading to a high
> probability that I pick the wrong one and accidentally
> create a new branch.
> 
> This patch adds a way for the user to tell the completion
> code not to include DWIM suggestions for checkout. This can
> already be done by typing:
> 
>   git checkout --no-guess jk/<TAB>
> 
> but that's rather cumbersome. The downside, of course, is
> that you no longer get completion support when you _do_ want
> to invoke the DWIM behavior. But depending on your workflow,
> that may not be a big loss (for instance, in git.git I am
> much more likely to want to detach, so I'd type "git
> checkout origin/jk/<TAB>" anyway).
> 
> Signed-off-by: Jeff King <peff@xxxxxxxx>

May not be relevant to this patch per-say, but is there a way to have
the completion for checkout only complete up to a part of
remotes/branches?  Say a forward-slash '/'.  For example git.git has
lots of branches which have the form: origin/<initials>/branch-name.  It
would be convenient if when I type:

git checkout <TAB> 

Instead of getting a long list of 2k or so branch names that instead I
would get see the remote's name e.g. 'origin/' kind of like vanilla
directory completion.  This way, unless I'm actually interested in the
remote, I don't see the thousands of branches related to it.

-- 
Brandon Williams



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux