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-completion-zsh.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh index 9e821eab9a..88157b0867 100644 --- a/contrib/completion/git-completion.zsh +++ b/contrib/completion/git-completion.zsh @@ -136,6 +136,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-completion-zsh.sh b/t/t9904-completion-zsh.sh index 27f5b42318..472b02d3e6 100755 --- a/t/t9904-completion-zsh.sh +++ b/t/t9904-completion-zsh.sh @@ -1034,7 +1034,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.33.0