git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Britton Leo Kerin" <britton.kerin@gmail.com>
To: <git@vger.kernel.org>
Cc: Britton Leo Kerin <britton.kerin@gmail.com>
Subject: [RFC PATCH 5/6] completion: recognize but do not complete 'view'
Date: Tue,  2 Jan 2024 10:57:43 -0900	[thread overview]
Message-ID: <cda06ddc-3de6-4fef-a6e2-a3da8c0bac25@smtp-relay.sendinblue.com> (raw)
In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com>

Completing it might annoy some existing users by creating completion
ambiguity on 'v' and 'vi' without adding anything useful in terms of
interface discovery/recall (because 'view' is just an alias anyway).

Signed-off-by: Britton Leo Kerin <britton.kerin@gmail.com>
---
 contrib/completion/git-completion.bash | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a09598c5c1..3bb790220a 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1589,13 +1589,16 @@ _git_bisect ()
 		term_good=`__git bisect terms --term-good`
 	fi
 
-	local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help"
+	# We want to recognize 'view' but not complete it, because it overlaps
+	# with 'visualize' too much and is just an alias for it.
+	local completable_subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help"
+	local all_subcommands="$completable_subcommands view"
 
-	local subcommand="$(__git_find_on_cmdline "$subcommands")"
+	local subcommand="$(__git_find_on_cmdline "$all_subcommands")"
 
 	if [ -z "$subcommand" ]; then
 		if [ -f "$__git_repo_path"/BISECT_START ]; then
-			__gitcomp "$subcommands"
+			__gitcomp "$completable_subcommands"
 		else
 			__gitcomp "replay start"
 		fi
@@ -1613,7 +1616,7 @@ _git_bisect ()
 			;;
 		esac
 		;;
-	visualize)
+	visualize|view)
 		case "$cur" in
 		-*)
 			__git_complete_log_opts
-- 
2.43.0



  parent reply	other threads:[~2024-01-02 19:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240102195744.478503-1-britton.kerin@gmail.com>
2024-01-02 19:57 ` [RFC PATCH 1/6] completion: complete new old actions, start opts Britton Leo Kerin
2024-01-02 19:57 ` [RFC PATCH 2/6] completion: git-log opts to bisect visualize Britton Leo Kerin
2024-01-02 19:57 ` [RFC PATCH 3/6] completion: move to maintain define-before-use Britton Leo Kerin
2024-01-02 19:57 ` [RFC PATCH 4/6] completion: custom git-bisect terms Britton Leo Kerin
2024-01-02 19:57 ` Britton Leo Kerin [this message]
2024-01-02 19:57 ` [RFC PATCH 6/6] completion: add comment Britton Leo Kerin

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

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

  git send-email \
    --in-reply-to=cda06ddc-3de6-4fef-a6e2-a3da8c0bac25@smtp-relay.sendinblue.com \
    --to=britton.kerin@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).