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] Add completion for short options
Date: Tue, 25 Nov 2025 08:42:27 -0800 [thread overview]
Message-ID: <xmqq5xayt66k.fsf@gitster.g> (raw)
In-Reply-To: <pull.2100.git.git.1764052739534.gitgitgadget@gmail.com> (Wiktor Mis via GitGitGadget's message of "Tue, 25 Nov 2025 06:38:59 +0000")
"Wiktor Mis via GitGitGadget" <gitgitgadget@gmail.com> writes:
As the large part of the completion script is about completing git
subcommands and options to these subcommands, it seems that nobody
noticed the lack of completion for options of "git" itself.
> Subject: Re: [PATCH] Add completion for short options
This title makes it appear much broader than what the patch does,
which is to complete "git -<TAB>" with short options for the "git"
potty.
Subjct: [PATCH] completion: complete "git -<TAB>" with short options
perhaps.
> From: Wiktor Mis <mwiktor023@gmail.com>
>
> Git provided completion for long options but not the short ones
Complete the sentence with something like
... not the short ones for "git" itself.
> Signed-off-by: Wiktor Mis <mwiktor023@gmail.com>
> ---
> Add completion for short options
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2100%2FWiktorro%2Fpatch-3-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2100/Wiktorro/patch-3-v1
> Pull-Request: https://github.com/git/git/pull/2100
>
> contrib/completion/git-completion.bash | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 73abea31b4..3f1d6c0955 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -3916,6 +3916,16 @@ __git_main ()
> --help
> "
> ;;
> + -*)
> + __gitcomp "
> + -C
> + -P
> + -c
> + -h
> + -p
> + -v
> + "
> + ;;
When you type
$ git -<TAB>
the current completion without this patch does nothing. The above
change makes it instead show the listed six.
Which is a good enough incremental update, I guess.
I however wonder if a separate follow-up change to let
$ git -<TAB>
to show completion for both short and long options make the world
even a better place. With the current completion, even with this
patch, you need to type double-dash-and-TAB to ask for list of long
options.
Thanks, will queue.
next prev parent reply other threads:[~2025-11-25 16:42 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 [this message]
2025-11-26 16:26 ` [PATCH v2] completion: complete "git -<TAB>" with " Wiktor Mis via GitGitGadget
2025-11-26 20:09 ` Junio C Hamano
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=xmqq5xayt66k.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).