Subject: Re: [PATCH 1/2] completion: suppress zsh's special 'words' variable

From: Jonathan Nieder <[email-masked]>
Date: Mon, 9 May 2011 22:17:08 -0500

Jonathan Nieder wrote:

>  contrib/completion/git-completion.bash |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

I forgot to list changes since v4:

 - new commit message
 - removed comment I considered unclear --- probably the following
   should be squashed in, though, to prevent someone from seeing the
   seemingly redundant "typeset -h words" and removing it, not
   realizing it is needed for compatibility with old zsh versions.

-- >8 --
From: Felipe Contreras <[email-masked]>
Subject: completion: add a comment to explain what "typeset -h words" is for

In current zsh master, bashcompinit hides the 'words' special variable
already, so our own "typeset -h words" in _git and _gitk might seem
redundant.  Add a comment to explain that it is there for
compatibility with old zsh versions.

[jn: based on the original comment by Felipe Contreras]

Signed-off-by: Jonathan Nieder <[email-masked]>
---
 contrib/completion/git-completion.bash |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index da586e5..b80830e 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2608,6 +2608,10 @@ _git ()
 	if [[ -n ${ZSH_VERSION-} ]]; then
 		emulate -L bash
 		setopt KSH_TYPESET
+
+		# Suppress the "words" special variable from zsh.
+		# Only zsh versions <= 4.3.11 need this --- in later
+		# versions, bashcompinit takes care of it.
 		typeset -h words
 	fi
 
@@ -2660,6 +2664,10 @@ _gitk ()
 	if [[ -n ${ZSH_VERSION-} ]]; then
 		emulate -L bash
 		setopt KSH_TYPESET
+
+		# Suppress the "words" special variable from zsh.
+		# Only zsh versions <= 4.3.11 need this --- in later
+		# versions, bashcompinit takes care of it.
 		typeset -h words
 	fi
 
-- 
1.7.5.1