The parseopt helper can generate the completions even if the function is unspecified. git version --<tab> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- contrib/completion/git-completion.zsh | 3 +++ t/t9904-zsh-completion.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh index e771a2a53a..30607aa93d 100644 --- a/contrib/completion/git-completion.zsh +++ b/contrib/completion/git-completion.zsh @@ -141,6 +141,9 @@ __git_complete_command () if (( $+functions[$completion_func] )); then emulate ksh -c $completion_func return 0 + elif emulate ksh -c "__git_support_parseopt_helper $command"; then + emulate ksh -c "__git_complete_common $command" + return 0 else return 1 fi diff --git a/t/t9904-zsh-completion.sh b/t/t9904-zsh-completion.sh index cd223b6e2a..14f5e5d9b8 100755 --- a/t/t9904-zsh-completion.sh +++ b/t/t9904-zsh-completion.sh @@ -1015,7 +1015,7 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c EOF ' -test_expect_failure 'completion without explicit _git_xxx function' ' +test_expect_success 'completion without explicit _git_xxx function' ' test_completion "git version --" <<-\EOF --build-options Z --no-build-options Z -- 2.37.2.351.g9bf691b78c.dirty