zsh completion broken for file completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]