From: Ben Knoble <ben.knoble@gmail.com>
To: Vincent Mailhol <mailhol@kernel.org>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Philippe Blain <levraiphilippeblain@gmail.com>,
Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2 2/4] completion: complete 'git history --empty' values
Date: Thu, 13 Aug 2026 07:12:48 -0400 [thread overview]
Message-ID: <00E5CBDB-7D2A-4117-9A52-FD5C64A9838C@gmail.com> (raw)
In-Reply-To: <CAMZ6RqLAYMSwNK=w=Xh+O==46eQCS=wFgBoUEOtQoBbLrBqd_A@mail.gmail.com>
> Le 13 août 2026 à 04:20, Vincent Mailhol <mailhol@kernel.org> a écrit :
>
> On Mon. 10 Aug. 2026 at 14:50, D. Ben Knoble <ben.knoble@gmail.com> wrote:
>> One other thing, sorry
>>
>>> On Thu, Aug 6, 2026 at 4:36 PM Vincent Mailhol <mailhol@kernel.org> wrote:
>>>
>>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>>> index 7372e2919b..fe5223b8ec 100644
>>> --- a/contrib/completion/git-completion.bash
>>> +++ b/contrib/completion/git-completion.bash
>>> @@ -2171,8 +2171,17 @@ _git_history ()
>>> fi
>>>
>>> if ! __git_has_doubledash; then
>>> - case "$cur" in
>>> - --*)
>>> + case "$prev,$cur" in
>>> + --empty,*|*,--empty=*)
>>> + case "$subcommand" in
>>> + drop|fixup)
>>
>> This feels a bit "inside out" to me, especially when reading the other
>> completions. I think the usual pattern is to check the subcommand
>> first and dispatch if necessary. Thoughts?
>
> The motivation is to have a single:
>
> case "$cur" in
>
> statement.
I now suspect this is why some use the « case "$subcommand,$cur" » variant ? Apologies for not thinking of that previously.
next prev parent reply other threads:[~2026-08-13 11:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 20:27 [PATCH v2 0/4] completion: add support for 'git history' Vincent Mailhol
2026-08-06 20:27 ` [PATCH v2 1/4] completion: add 'git history' subcommands Vincent Mailhol
2026-08-07 6:30 ` Patrick Steinhardt
2026-08-07 6:44 ` Vincent Mailhol
2026-08-07 7:08 ` Patrick Steinhardt
2026-08-07 8:09 ` Vincent Mailhol
2026-08-10 12:43 ` D. Ben Knoble
2026-08-06 20:27 ` [PATCH v2 2/4] completion: complete 'git history --empty' values Vincent Mailhol
2026-08-10 12:48 ` D. Ben Knoble
2026-08-10 12:50 ` D. Ben Knoble
2026-08-13 8:20 ` Vincent Mailhol
2026-08-13 11:12 ` Ben Knoble [this message]
2026-08-06 20:27 ` [PATCH v2 3/4] completion: complete 'git history --update-refs' values Vincent Mailhol
2026-08-10 12:52 ` D. Ben Knoble
2026-08-06 20:27 ` [PATCH v2 4/4] completion: complete 'git history split' pathspecs Vincent Mailhol
2026-08-10 12:58 ` D. Ben Knoble
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=00E5CBDB-7D2A-4117-9A52-FD5C64A9838C@gmail.com \
--to=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=levraiphilippeblain@gmail.com \
--cc=mailhol@kernel.org \
--cc=ps@pks.im \
/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