[PATCH for maint] git-completion: fix zsh support
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- May 5, 2011, 19:52 UTC
- Message-ID
- <1304625144-5206-1-git-send-email-felipe.contreras@gmail.com>
- In-Reply-To
- <20110505185907.GD1377@goldbirke>
It turns out 'words' is a special variable used by zsh completion.
There's probably a bug in zsh's bashcompinit: http://article.gmane.org/gmane.comp.shells.zsh.devel/22546
But in the meantime we can workaround it by using 'typedef -h', which gets rid of any special meaning.
Currently zsh is completely broken after commit da48616 (bash: get --pretty=m<tab> completion to work with bash v4), which introduced _get_comp_words_by_ref() that comes from debian's bash_completion scripts, and relies on the 'words' variable to behave like any normal variable.
Comments-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- contrib/completion/git-completion.bash | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
This patch is meant for the maintenance branch, so Szeder's patches are not required as dependency (althought they are good by themselves).
v2: fix _gitk() too as Szeder suggested.
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 840ae38..74c0b4d 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2710,6 +2710,9 @@ _git () if [[ -n ${ZSH_VERSION-} ]]; then emulate -L bash setopt KSH_TYPESET + + # 'words' has special meaning in zsh; override that + typeset -h words fi local cur words cword @@ -2761,6 +2764,9 @@ _gitk () if [[ -n ${ZSH_VERSION-} ]]; then emulate -L bash setopt KSH_TYPESET + + # 'words' has special meaning in zsh; override that + typeset -h words fi __git_has_doubledash && return
-- 1.7.5.1.1.g638e6