git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* zsh completion broken for file completion
@ 2013-02-28 18:43 Matthieu Moy
  2013-02-28 18:59 ` Manlio Perillo
  2013-03-05  8:43 ` [PATCH] git-completion.zsh: define __gitcomp_file compatibility function Matthieu Moy
  0 siblings, 2 replies; 6+ messages in thread
From: Matthieu Moy @ 2013-02-28 18:43 UTC (permalink / raw)
  To: git, Felipe Contreras, Manlio Perillo

Hi,

The completion for e.g. "git add file<tab>" is broken in master. I get
the following result:

git add fo__gitcomp_file:8: command not found: compgen

The guilty commit is fea16b47b60 (Fri Jan 11 19:48:43 2013, Manlio
Perillo, git-completion.bash: add support for path completion), which
introduces a new __gitcomp_file function that uses the bash builtin
"compgen", without redefining the function in git-completion.zsh.

The following proof-of-concept patch seems to fix the problem for me (I
basically copied the __gitcomp_nl function to __gitcomp_file and removed
the '-S "${4- }"'). The bash version does "compopt -o filenames", I
don't know what zsh equivalent is.

diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 4577502..0ba1dcf 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -60,6 +60,15 @@ __gitcomp_nl ()
        compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
 }
 
+__gitcomp_file ()
+{
+       emulate -L zsh
+
+       local IFS=$'\n'
+       compset -P '*[=:]'
+       compadd -Q -p "${2-}" -- ${=1} && _ret=0
+}
+
 _git ()
 {
        local _ret=1

Felipe, you know ZSH completion much better than me. Could you turn this
into a real patch?

Thanks,

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-02 12:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28 18:43 zsh completion broken for file completion Matthieu Moy
2013-02-28 18:59 ` Manlio Perillo
2013-04-01  9:30   ` Felipe Contreras
     [not found]   ` <CAMP44s3=pHAUHohgJxddVdXMRj-toWOEvKea-E02mEZPBLk25w@mail.gmail.com>
2013-04-02 12:47     ` Manlio Perillo
2013-03-05  8:43 ` [PATCH] git-completion.zsh: define __gitcomp_file compatibility function Matthieu Moy
2013-03-05 16:54   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).