Re: [PATCH] git-completion: fix zsh support
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 27, 2011, 02:21 UTC
- Message-ID
- <20110427022117.GA16697@elie>
- In-Reply-To
- <1303867612-15975-1-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras wrote:
> +++ b/contrib/completion/git-completion.bash
[...]
Show 9 quoted lines
> @@ -739,12 +739,12 @@ __git_complete_revlist ()
>
> __git_complete_remote_or_refspec ()
> {
> - local cur words cword
> - _get_comp_words_by_ref -n =: cur words cword
> - local cmd="${words[1]}"
> + local cur cwords cword
> + _get_comp_words_by_ref -n =: cur cwords cwordHmm, on second thought, this will break the following case, in bash:
. /etc/bash_completion; # defines _get_comp_words_by_ref . contrib/completion/git-completion.bash
Not sure how to salvage that. Maybe we need a git-specific API that wraps _get_comp_words_by_ref when the latter is available.
if type _get_comp_words_by_ref >/dev/null 2>&1; then
_git_get_comp_words_by_ref () {
_get_comp_words_by_ref "$@"
if test "${words+set}"
then
cword="${words[@]}"
fi
}
else
_git_get_comp_words_by_ref () {
...
}
fi