Re: [PATCH v2 3/4] completion: complete 'git history --update-refs' values

"D. Ben Knoble" <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CALnO6CDZURfK3HFQF_LYrSz0KWtamUguVWK3-cnVUCeA+oVBHQ@mail.gmail.com>
On Thu, Aug 6, 2026 at 4:37 PM Vincent Mailhol <[email protected]> wrote:
>
> The "--update-refs" option accepts either "branches" or "head".
> Complete these values.
>
> Although the synopsis only documents the:
>
>   --update-refs=<value>
>
> form, parse-options also accepts the value as a separate argument:
>
>   --update-refs <value>
>
> Support both forms to follow the parser.
>
> Signed-off-by: Vincent Mailhol <[email protected]>
> ---
> Changes in v2:
>
>   - New patch.
> ---
>  contrib/completion/git-completion.bash | 5 +++++
>  t/t9902-completion.sh                  | 6 +++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index fe5223b8ec..6f1ba96763 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2181,6 +2181,11 @@ _git_history ()
>                                 ;;
>                         esac
>                         ;;
> +               --update-refs,*|*,--update-refs=*)
> +                       __gitcomp "branches head" "" \
> +                               "${cur##--update-refs=}"
> +                       return
> +                       ;;

Contrary to my comments on 2/4, this seems like a reasonable place for
--update-refs, since that applies to all current git-history commands.
If that ever changes, well… we'll deal with it then I suppose.

>                 *,--*)
>                         __gitcomp_builtin "history_$subcommand"
>                         return
[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.