]> git.ipfire.org Git - thirdparty/git.git/commit
git-completion.bash: use __gitcomp_builtin() in _git_stash()
authorDenton Liu <liu.denton@gmail.com>
Wed, 24 Mar 2021 08:36:29 +0000 (01:36 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Mar 2021 17:05:47 +0000 (10:05 -0700)
commit61318078640dc1bbe07c5d762f7a581b7408d623
tree36b497ae09077b0a95e55983b09a07d032e0228c
parent42b30bcbb7929527631225a89a5630057535d766
git-completion.bash: use __gitcomp_builtin() in _git_stash()

The completion for 'git stash' has not changed in a major way since it
was converted from shell script to builtin. Now that it's a builtin, we
can take advantage of the groundwork laid out by parse-options and use
the generated options.

Rewrite _git_stash() to take use __gitcomp_builtin() to generate
completions for subcommands.

The main `git stash` command does not take any arguments directly. If no
subcommand is given, it automatically defaults to `git stash push`. This
means that we can simplify the logic for when no subcommands have been
given yet. We only have to offer subcommand completions when we're
completing a non-option after "stash".

One area that this patch could improve upon is that the `git stash list`
command accepts log-options. It would be nice if the completion for this
were unified with that of _git_log() and _git_show() which would allow
completions to be provided for options such as `--pretty` but that is
outside the scope of this patch.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash