Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: ZSH segmentation fault while completing "git mv dir/"

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:56:35

On Tue, Mar 12, 2013 at 1:53 AM, Matthieu Moy
[off-list ref] wrote:
If I add a simple 'echo "$cur" >&2' instead of the case, the problem
reappears. Somehow, the fact that I'm accessing $cur seems to create the
segfault. Actually, the minimalistic _git_mv reproducing the problem is:

_git_mv ()
{
        echo "$cur"
        [ $(__git_count_arguments "mv") = 1 ]
        __git_complete_index_file "--cached --others --directory"
}
I managed to reproduce the issue, and to me, this is enough:

_git_mv ()
{
__gitcomp_file 'bar.txt' 'foo/'
}

And this is a workaround:
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -66,7 +66,7 @@ __gitcomp_file ()

        local IFS=$'\n'
        compset -P '*[=:]'
-       compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
+       compadd -Q -p "${2-}" -- ${=1} && _ret=0
 }

 _git ()
Cheers.

--
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help