git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Jacob Keller <jacob.keller@gmail.com>
Subject: [PATCH v2 0/9] refactor completion for switch and checkout
Date: Wed, 27 May 2020 04:38:22 -0700	[thread overview]
Message-ID: <20200527113831.3294409-1-jacob.e.keller@intel.com> (raw)

From: Jacob Keller <jacob.keller@gmail.com>

completion support for git switch is subpar for a number of cases. Most
notable is difference in behavior between these two completions:

  $git switch <TAB>
  Display all 784 possibilities? (y or n)
  <list of all references and DWIM remotes>

  $git switch --track<TAB>
  jk-refactor-git-switch-completion master`

If --track is provided, tab completion becomes almost useless, because we
would expect to complete remote references, but instead can only complete
local branches!

This series was motivated by a desire to fix the completion for the above
two cases, but I noticed several other issues on the way, including some
issues understanding what the current logic did.

This series aims to improve the completion support, and comes with many
additional test cases that cover the new behavior implemented in the various
patches.

This is a rework of a previous series posted, available at the following URL:
https://lore.kernel.org/git/20200425022045.1089291-1-jacob.e.keller@intel.com/

Note that although I've marked this as a v2, I did not find the range-diff
to be satisfying or useful and have not included it. Besides not being very
useful, not many folks seem to have reviewed the original anyways.

The most notable change in behavior since v1 is how we handle the -c/-C
options. It makes sense to complete the argument of -c differently than how
we handle the start-point after we already have a completed branch name. The
exact requirements of *how* we complete branch names is easily modified if
anyone has a better suggestion.

Finally, I also applied many of the same improvements to checkout where
appropriate, and have included many more additional tests for both git
switch and git checkout.

Jacob Keller (9):
  completion: replace overloaded track term for __git_complete_refs
  completion: improve handling of DWIM mode for switch/checkout
  completion: extract function __git_dwim_remote_heads
  completion: perform DWIM logic directly in __git_complete_refs
  completion: improve completion for git switch with no options
  completion: improve handling of --detach in checkout
  completion: improve handling of --track in switch/checkout
  completion: improve handling of -c/-C and -b/-B in switch/checkout
  completion: improve handling of --orphan option of switch/checkout

 contrib/completion/git-completion.bash | 252 +++++++++++---
 t/t9902-completion.sh                  | 455 +++++++++++++++++++++++++
 2 files changed, 668 insertions(+), 39 deletions(-)

-- 
2.25.2


             reply	other threads:[~2020-05-27 11:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 11:38 Jacob Keller [this message]
2020-05-27 11:38 ` [PATCH v2 1/9] completion: replace overloaded track term for __git_complete_refs Jacob Keller
2020-05-27 11:38 ` [PATCH v2 2/9] completion: improve handling of DWIM mode for switch/checkout Jacob Keller
2020-05-27 18:03   ` Junio C Hamano
2020-05-27 19:41     ` Jacob Keller
2020-05-28  8:53       ` Jacob Keller
2020-05-27 11:38 ` [PATCH v2 3/9] completion: extract function __git_dwim_remote_heads Jacob Keller
2020-05-27 11:38 ` [PATCH v2 4/9] completion: perform DWIM logic directly in __git_complete_refs Jacob Keller
2020-05-27 11:38 ` [PATCH v2 5/9] completion: improve completion for git switch with no options Jacob Keller
2020-05-27 11:38 ` [PATCH v2 6/9] completion: improve handling of --detach in checkout Jacob Keller
2020-05-27 11:38 ` [PATCH v2 7/9] completion: improve handling of --track in switch/checkout Jacob Keller
2020-05-27 11:38 ` [PATCH v2 8/9] completion: improve handling of -c/-C and -b/-B " Jacob Keller
2020-05-27 11:38 ` [PATCH v2 9/9] completion: improve handling of --orphan option of switch/checkout Jacob Keller

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=20200527113831.3294409-1-jacob.e.keller@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.keller@gmail.com \
    --cc=jrnieder@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).