All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH for maint branch] git-completion: fix zsh support
Date: Thu, 5 May 2011 20:59:07 +0200	[thread overview]
Message-ID: <20110505185907.GD1377@goldbirke> (raw)
In-Reply-To: <1304605458-1483-1-git-send-email-felipe.contreras@gmail.com>

Hi,

On Thu, May 05, 2011 at 05:24:18PM +0300, Felipe Contreras wrote:
> 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 this way.

I would prefer some details about this "workaround it this way" in the
commit message (i.e. that you used "typedef -h", what it does in zsh,
and why it fixes the issue; my zsh-fu is, well, not particularly
large, so I have no idea), so when someone later runs 'git log --
contrib/completion' then he will easier understand what's going on
without the need to look at the patch.

> 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.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  contrib/completion/git-completion.bash |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> This patch is meant for the maintenance branch, so Szeder's patches are not
> needed.

My first two patches are cleanups, they definitely worth
keeping, even when this patch alone would fix the zsh issues.

> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 840ae38..8d5eae7 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

You have to do the same in _gitk(), too.  Although _gitk() itself
doesn't use $words, it invokes __git_has_doubledash(), which does,
hence it's still broken.

>  	fi
>  
>  	local cur words cword
> -- 
> 1.7.5.1.1.g638e6
> 

  parent reply	other threads:[~2011-05-05 18:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 14:24 [PATCH for maint branch] git-completion: fix zsh support Felipe Contreras
2011-05-05 17:34 ` Junio C Hamano
2011-05-05 19:29   ` Felipe Contreras
2011-05-05 18:59 ` SZEDER Gábor [this message]
2011-05-05 19:52   ` [PATCH for maint] " Felipe Contreras
2011-05-05 23:25     ` Jonathan Nieder
2011-05-06  4:51       ` Junio C Hamano
2011-05-06  5:27         ` Jonathan Nieder
2011-05-06  9:34           ` Felipe Contreras
2011-05-06  9:27       ` Felipe Contreras
2011-05-06  9:59         ` Jonathan Nieder
2011-05-06 10:06           ` Jonathan Nieder
2011-05-09 13:51           ` Felipe Contreras
2011-05-06  1:28     ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110505185907.GD1377@goldbirke \
    --to=szeder@ira.uka.de \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.