From patchwork Tue Jan 2 19:57:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13509340 Received: from aa.d.sender-sib.com (aa.d.sender-sib.com [185.41.28.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F6691642A for ; Tue, 2 Jan 2024 19:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aa.d.sender-sib.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sendinblue.com header.i=@sendinblue.com header.b="NikABz6S" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=EwHth4Wf8RKasRYK+iVEJ5qxoMKviQZohIYWZcwE48U=; h=from:subject:date:to:cc:mime-version:content-transfer-encoding:in-reply-to:references:x-csa-complaints:list-unsubscribe-post; b=NikABz6Svo91D0iCl+KOxMtxdAN5jyEV26d6eCzqah2dPP19gTotsokRLPaotuHzrq/yQg89P+Wu Wk/ne9IGo4c+MYMbgehkTrqlxumNiEg1afNf/bfjbKNSwOiqVeZt89AJZ1g8fpujGTquQAaJGcJf LXp4S9O4DuRZu1GXs0g= Received: by smtp-relay.sendinblue.com with ESMTP id cda06ddc-3de6-4fef-a6e2-a3da8c0bac25; Tue, 02 January 2024 19:57:55 +0000 (UTC) X-Mailin-EID: MjQyODY0MDE0fmdpdEB2Z2VyLmtlcm5lbC5vcmd%2BPDIwMjQwMTAyMTk1NzQ0LjQ3ODUwMy02LWJyaXR0b24ua2VyaW5AZ21haWwuY29tPn5hYS5kLnNlbmRlci1zaWIuY29t Date: Tue, 2 Jan 2024 10:57:43 -0900 Subject: [RFC PATCH 5/6] completion: recognize but do not complete 'view' Received: by brittons-large-Vivobook (Postfix, from userid 1000) id E6484520263; Tue, 2 Jan 2024 10:57:52 -0900 (AKST) Cc: Britton Leo Kerin X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com> References: <20240102195744.478503-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: Origin-messageId: <20240102195744.478503-6-britton.kerin@gmail.com> To: X-sib-id: EqSk34DoGcqbfgSyS6NXUfesj1fWarMKoVIcUYQTxUiHomX9DmtHUNcbtgxvrSKVABZFpFgj8kCldFzEW4t8yNh3dX-htFB9ih6tGFU5L8a_JHAQ54UHAfvQytX4JMApIZy1-acQabBdRyh62z19GYRYwDbwOm4N28wgNlvUBE0r X-CSA-Complaints: csa-complaints@eco.de List-Unsubscribe-Post: List-Unsubscribe=One-Click Feedback-ID: 185.41.28.128:6940237_-1:6940237:Sendinblue From: "Britton Leo Kerin" 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 --- 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