git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Williams <bmwill@google.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, "SZEDER Gábor" <szeder.dev@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH v2] completion: optionally disable checkout DWIM
Date: Mon, 24 Apr 2017 09:30:02 -0700	[thread overview]
Message-ID: <20170424163002.GB195761@google.com> (raw)
In-Reply-To: <20170421202705.4uhbk3okccszxvgl@sigill.intra.peff.net>

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@peff.net>

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

      reply	other threads:[~2017-04-24 16:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 20:12 [PATCH] completion: optionally disable checkout DWIM Jeff King
2017-04-21  5:01 ` Junio C Hamano
2017-04-21  5:03   ` Jeff King
2017-04-21  5:30     ` Junio C Hamano
2017-04-21 20:14   ` SZEDER Gábor
2017-04-21 20:19     ` Jeff King
2017-04-22 17:32       ` SZEDER Gábor
2017-04-21  7:25 ` Jacob Keller
2017-04-21 20:27 ` [PATCH v2] " Jeff King
2017-04-24 16:30   ` Brandon Williams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170424163002.GB195761@google.com \
    --to=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).