git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Aug 10, 2026, 12:58 UTC
Message-ID
<CALnO6CBThicX2x_acKoSvWMOkr4pa5bVMH=RNMXO+BjEAxKSHg@mail.gmail.com>
In-Reply-To
<20260806-history_autocompletion-v2-4-7e60f52a1c20@kernel.org>
On Thu, Aug 6, 2026 at 4:37 PM Vincent Mailhol <mailhol@kernel.org> wrote:
Show 29 quoted lines
>
> 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 <mailhol@kernel.org>
> ---
> 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
Previous: Vincent Mailhol
Message 17 of 17 in “completion: add support for 'git history'”
  1. 0/4 completion: add support for 'git history'Vincent Mailhol, Aug 6, 2026
  2. 1/4 completion: add 'git history' subcommandsVincent Mailhol, Aug 6, 2026
  3. Patrick SteinhardtAug 7, 2026
  4. Vincent MailholAug 7, 2026
  5. Patrick SteinhardtAug 7, 2026
  6. Vincent MailholAug 7, 2026
  7. D. Ben KnobleAug 10, 2026
  8. 2/4 completion: complete 'git history --empty' valuesVincent Mailhol, Aug 6, 2026
  9. D. Ben KnobleAug 10, 2026
  10. D. Ben KnobleAug 10, 2026
  11. Vincent MailholAug 13, 2026
  12. Ben KnobleAug 13, 2026
  13. Vincent MailholAug 13, 2026
  14. 3/4 completion: complete 'git history --update-refs' valuesVincent Mailhol, Aug 6, 2026
  15. D. Ben KnobleAug 10, 2026
  16. 4/4 completion: complete 'git history split' pathspecsVincent Mailhol, Aug 6, 2026
  17. D. Ben KnobleAug 10, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.