# [PATCH] completion: fix warning for zsh

2 messages from 2012-11-29 to 2012-11-29. Participants: Felipe Contreras, Junio C Hamano.
Thread: https://gitlist.dev/t/32237

## Felipe Contreras, 2012-11-29 08:20

Subject: [PATCH] completion: fix warning for zsh
Message-ID: <1354177257-5416-1-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1354177257-5416-1-git-send-email-felipe.contreras%40gmail.com

```
Otherwise the user might get something like:

  git-completion.sh:2466: command not found: compdef

If this script is loaded before compinit. The script would work either
way, but let's not be more annoying to the user.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.bash | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index af13fcc..0b77eb1 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2404,6 +2404,8 @@ __gitk_main ()
 if [[ -n ${ZSH_VERSION-} ]]; then
 	echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
 
+	autoload -U +X compinit && compinit
+
 	__gitcomp ()
 	{
 		emulate -L zsh
-- 
1.8.0.1

```

## Junio C Hamano, 2012-11-29 18:02

Subject: Re: [PATCH] completion: fix warning for zsh
Message-ID: <7vboegqod4.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vboegqod4.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1354177257-5416-1-git-send-email-felipe.contreras@gmail.com>

```
Will apply directly on 'master'; thanks.

```
