Re: [PATCH v2 4/4] completion: complete 'git history split' pathspecs

"D. Ben Knoble" <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CALnO6CBThicX2x_acKoSvWMOkr4pa5bVMH=RNMXO+BjEAxKSHg@mail.gmail.com>
On Thu, Aug 6, 2026 at 4:37 PM Vincent Mailhol <[email protected]> wrote:
>
> Arguments following the required revision of "git history split" are
> pathspecs. Complete them from tracked paths, including after an explicit
> "--".
>
> Signed-off-by: Vincent Mailhol <[email protected]>
> ---
> Changes in v2:
>
>   - New patch.
> ---
>  contrib/completion/git-completion.bash |  6 ++++++
>  t/t9902-completion.sh                  | 13 +++++++++++++
>  2 files changed, 19 insertions(+)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6f1ba96763..d313780d8b 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2197,6 +2197,12 @@ _git_history ()
>                 __git_complete_refs
>                 return
>         fi
> +
> +       case "$subcommand" in
> +       split)
> +               __git_complete_index_file "--cached"
> +               ;;
> +       esac

In context, this seems late to me relative to other completion functions:

- complete subcommands
- special case a few options
- handle revisions
- split

vs., say, _git_notes, _git_reflog, etc. where the pattern is

    case "$subcommand,$cur" in

to dispatch on combinations. We could use "split,*)" to dispatch there.

OTOH! The split completion wants to benefit from the other things done
(like revision completion), and only then (before or after --)
delegate to pathspecs. So, I dunno: I think this location achieves
that goal, but it diverges somewhat from the way other completions are
written.

[snip]

-- 
D. Ben Knoble
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.