* 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
* Re: zsh completion broken for file completion
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-03-05 8:43 ` [PATCH] git-completion.zsh: define __gitcomp_file compatibility function Matthieu Moy
1 sibling, 2 replies; 6+ messages in thread
From: Manlio Perillo @ 2013-02-28 18:59 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git, Felipe Contreras
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 28/02/2013 19:43, Matthieu Moy ha scritto:
> 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.
>
> [...]
> 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
> +}
> +
This patch is implemented in fea16b47b60, but only for the deprecated
zsh compatibility code inside git-completion.bash.
The reason I did not provided a patch for git-completion.zsh was because
there was a bug in this script [1].
If any changes are made to git-completion.zsh, please update
git-completion.bash, too.
[1] Basically, on my system I need the following change at the end of
the file:
-_git
+autoload -U +X compinit && compinit
+compdef _git git gitk
I don't know the reason, however; and it seems that it is a problem
only for me
> [...]
Regards Malio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlEvqRUACgkQscQJ24LbaURASgCeILUTXAiZA6Ndf2DHByJfv4nT
2bMAn1gPqSdfIBzb0cexwYNoAuD5j2+O
=sKTR
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: zsh completion broken for file completion
2013-02-28 18:59 ` Manlio Perillo
@ 2013-04-01 9:30 ` Felipe Contreras
[not found] ` <CAMP44s3=pHAUHohgJxddVdXMRj-toWOEvKea-E02mEZPBLk25w@mail.gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Felipe Contreras @ 2013-04-01 9:30 UTC (permalink / raw)
To: Manlio Perillo; +Cc: Matthieu Moy, git
On Thu, Feb 28, 2013 at 12:59 PM, Manlio Perillo
<manlio.perillo@gmail.com> wrote:
>
> [1] Basically, on my system I need the following change at the end of
> the file:
>
> -_git
> +autoload -U +X compinit && compinit
> +compdef _git git gitk
>
> I don't know the reason, however; and it seems that it is a problem
> only for me
Are you sourcing this script? If so, don't; do what is suggested at
the top: use fpath to load it automatically.
Cheers.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAMP44s3=pHAUHohgJxddVdXMRj-toWOEvKea-E02mEZPBLk25w@mail.gmail.com>]
* Re: zsh completion broken for file completion
[not found] ` <CAMP44s3=pHAUHohgJxddVdXMRj-toWOEvKea-E02mEZPBLk25w@mail.gmail.com>
@ 2013-04-02 12:47 ` Manlio Perillo
0 siblings, 0 replies; 6+ messages in thread
From: Manlio Perillo @ 2013-04-02 12:47 UTC (permalink / raw)
To: Felipe Contreras; +Cc: Matthieu Moy, git
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 01/04/2013 11:29, Felipe Contreras ha scritto:
>
>
> On Thu, Feb 28, 2013 at 12:59 PM, Manlio Perillo
> <manlio.perillo@gmail.com <mailto:manlio.perillo@gmail.com>> wrote:
>
>
> [1] Basically, on my system I need the following change at the end of
> the file:
>
> -_git
> +autoload -U +X compinit && compinit
> +compdef _git git gitk
>
> I don't know the reason, however; and it seems that it is a problem
> only for me
>
>
> Are you sourcing this script? If so, don't; do what is suggested at the
> top: use fpath to load it automatically.
>
I'm using fpath as documented.
However I tested the script again, and now seems to work correctly.
It is possible that in the past I was using an incorrect configuration.
Thanks Manlio Perillo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlFa01IACgkQscQJ24LbaUQOmACghDC30GqXXPIExHOPl9HrrO1y
BYgAn2QPAYvtsSAAiPpgMnmMRI3z0LE8
=kmm0
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] git-completion.zsh: define __gitcomp_file compatibility function
2013-02-28 18:43 zsh completion broken for file completion Matthieu Moy
2013-02-28 18:59 ` Manlio Perillo
@ 2013-03-05 8:43 ` Matthieu Moy
2013-03-05 16:54 ` Junio C Hamano
1 sibling, 1 reply; 6+ messages in thread
From: Matthieu Moy @ 2013-03-05 8:43 UTC (permalink / raw)
To: git, gitster; +Cc: felipe.contreras, manlio.perillo, Matthieu Moy
Commit fea16b47b60 (Fri Jan 11 19:48:43 2013, Manlio Perillo,
git-completion.bash: add support for path completion), introduced a new
__gitcomp_file function that uses the bash builtin "compgen". The
function was redefined for ZSH in the deprecated section of
git-completion.bash, but not in the new git-completion.zsh script.
As a result, users of git-completion.zsh trying to complete "git add
fo<tab>" get an error:
git add fo__gitcomp_file:8: command not found: compgen
This patch adds the redefinition and removes the error.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
> Felipe, you know ZSH completion much better than me. Could you turn this
> into a real patch?
No response from Felipe, so I'm trying my own patch. Compared to the
snippet I already sent, I added the -f option to "compadd", which was
there in the __gitcomp_file function defined in the deprecated ZSH
compatibility section of the bash script, and gives the ZSH equivalent
for "compopt -o filenames".
This fixes an annoying regression for ZSH users, so it may deserve to
be in the future 1.8.2.
contrib/completion/git-completion.zsh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 4577502..cf8116d 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-}" -f -- ${=1} && _ret=0
+}
+
_git ()
{
local _ret=1
--
1.8.1.3.572.g35e1b60
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] git-completion.zsh: define __gitcomp_file compatibility function
2013-03-05 8:43 ` [PATCH] git-completion.zsh: define __gitcomp_file compatibility function Matthieu Moy
@ 2013-03-05 16:54 ` Junio C Hamano
0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-03-05 16:54 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git, felipe.contreras, manlio.perillo
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
> Commit fea16b47b60 (Fri Jan 11 19:48:43 2013, Manlio Perillo,
> git-completion.bash: add support for path completion), introduced a new
> __gitcomp_file function that uses the bash builtin "compgen". The
> function was redefined for ZSH in the deprecated section of
> git-completion.bash, but not in the new git-completion.zsh script.
>
> As a result, users of git-completion.zsh trying to complete "git add
> fo<tab>" get an error:
>
> git add fo__gitcomp_file:8: command not found: compgen
>
> This patch adds the redefinition and removes the error.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
>> Felipe, you know ZSH completion much better than me. Could you turn this
>> into a real patch?
>
> No response from Felipe, so I'm trying my own patch. Compared to the
> snippet I already sent, I added the -f option to "compadd", which was
> there in the __gitcomp_file function defined in the deprecated ZSH
> compatibility section of the bash script, and gives the ZSH equivalent
> for "compopt -o filenames".
>
> This fixes an annoying regression for ZSH users, so it may deserve to
> be in the future 1.8.2.
Thanks, and I agree a fix to this issue should be fast-tracked.
>
> contrib/completion/git-completion.zsh | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
> index 4577502..cf8116d 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-}" -f -- ${=1} && _ret=0
> +}
> +
> _git ()
> {
> local _ret=1
^ permalink raw reply [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).