git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Wiktor Mis via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Wiktor Mis <mwiktor023@gmail.com>
Subject: Re: [PATCH v2] completion: complete "git -<TAB>" with short options
Date: Wed, 26 Nov 2025 12:09:22 -0800	[thread overview]
Message-ID: <xmqqh5ugmu8d.fsf@gitster.g> (raw)
In-Reply-To: <pull.2100.v2.git.git.1764174391776.gitgitgadget@gmail.com> (Wiktor Mis via GitGitGadget's message of "Wed, 26 Nov 2025 16:26:31 +0000")

"Wiktor Mis via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Wiktor Mis <mwiktor023@gmail.com>
>
> "git" itself has completion for long options and cmds, but not short ones
>
> Signed-off-by: Wiktor Mis <mwiktor023@gmail.com>
> ---
>     Add completion for short options

Will queue with a slight update to the log message.  I am unsure if
we want to limit "-<TAB>" to one-letter options or if we want to
include the long ones (the latter is what v2 implements), but let's
see if others have strong opinions.

    completion: complete "git -<TAB>" with short options

    "git" itself has completion for its long options and subcommands,
    but not for its short options.  Add support for them.

    Signed-off-by: Wiktor Mis <mwiktor023@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thanks.

>  contrib/completion/git-completion.bash | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 73abea31b4..1705ca3323 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -3898,7 +3898,7 @@ __git_main ()
>  			;;
>  		esac
>  		case "$cur" in
> -		--*)
> +		-*)
>  			__gitcomp "
>  			--paginate
>  			--no-pager
> @@ -3914,6 +3914,12 @@ __git_main ()
>  			--namespace=
>  			--no-replace-objects
>  			--help
> +			-C
> +			-P
> +			-c
> +			-h
> +			-p
> +			-v
>  			"
>  			;;
>  		*)
>
> base-commit: fd372d9b1a69a01a676398882bbe3840bf51fe72

  reply	other threads:[~2025-11-26 20:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  6:38 [PATCH] Add completion for short options Wiktor Mis via GitGitGadget
2025-11-25 16:42 ` Junio C Hamano
2025-11-26 16:26 ` [PATCH v2] completion: complete "git -<TAB>" with " Wiktor Mis via GitGitGadget
2025-11-26 20:09   ` Junio C Hamano [this message]
2025-11-27  7:33     ` SZEDER Gábor
2025-11-27 21:59       ` Junio C Hamano
2025-12-07  0:38         ` Junio C Hamano

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=xmqqh5ugmu8d.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=mwiktor023@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.
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).