completion: fix conflict with bashcomp

We don't want to override the 'complete()' function in zsh, which can be used by bashcomp. Reported-by: Mark Lodato <lodato@google.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Oct 27, 2020 at 20:06 UTC 3791968bfe8485353f95e692c5a3891e4a02c5c4
1 file changed +4 -6
contrib/completion/git-completion.zsh
+4 -6
@@ -21,12 +21,6 @@
21 # zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
22 #
23
24 -complete ()
25 -{
26 - # do nothing
27 - return 0
28 -}
29 -
24 zstyle -T ':completion:*:*:git:*' tag-order && \
25 zstyle ':completion:*:*:git:*' tag-order 'common-commands'
26
@@ -48,7 +42,11 @@ if [ -z "$script" ]; then
42 test -f $e && script="$e" && break
43 done
44 fi
45 +
46 +local old_complete="$functions[complete]"
47 +functions[complete]=:
48 GIT_SOURCING_ZSH_COMPLETION=y . "$script"
49 +functions[complete]="$old_complete"
50
51 __gitcomp ()
52 {