Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 5.0.3 +* -> git completion regression



On 2013-12-16 at 09:47 +0000, Peter Stephenson wrote:
> On Mon, 16 Dec 2013 03:14:37 -0500
> Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> > % git push origin <TAB>
> > __git_complete_remote_or_refspec:33: bad pattern: +*
> 
> I can't think of any circumstance where +* should be a bad pattern.  Is
> this easy to reproduce in a simple example?

Finally managed it.  It seems that the _git wrapper has a function
__git_zsh_bash_func() which does "emulate -L ksh" and somehow that
breaks when calling into the functions, while sourcing the file under
sticky sh emulation (via "emulate sh -c") overrides that ksh context and
fixes this.

% zsh -f
ilmenite% emulate ksh
ilmenite% case "$foo" in +*) echo snert;; esac
zsh: bad pattern: +*
%


I have git-1.8.5.1 from HomeBrew on a Mac, and zsh 5.0.3 from MacPorts
(yeah, mixing those two isn't great, but not relevant here).  I used git
bisect to find the triggering commit in zsh, doing a
configure/make/make-install cycle with each, invoking that shell,
switching to a git repo dir and typing "git push origin <TAB>".

I didn't use "zsh -f" during that cycle, but for completeness:

    % zsh -f
    ilmenite% fpath=(/usr/local/share/zsh/site-functions $fpath)
    ilmenite% autoload compinit ; compinit
    ilmenite% cd ~/path/to/a/git/repo/
    ilmenite% git push origin 
    __git_complete_remote_or_refspec:33: bad pattern: +*
    ilmenite%

Without the fpath adjustment, I get the _git completion from zsh and
everything works fine.  It's only the git-supplied zsh completion
configuration which breaks until I force emulation mode for the .bash
inclusion.

----------------------------8< cut here >8------------------------------
+__git_zsh_main:25> case arg (command)
+__git_zsh_main:25> case arg (arg)
+__git_zsh_main:33> local 'command=push' __git_dir
+__git_zsh_main:35> ((  0  ))
+__git_zsh_main:38> __git_dir=''·
+__git_zsh_main:41> ((  0  ))
+__git_zsh_main:43> words=( git push origin )·
+__git_zsh_main:45> __git_zsh_bash_func push
+__git_zsh_bash_func:2> emulate -L ksh
+__git_zsh_bash_func:4> local 'command=push'
+__git_zsh_bash_func:6> local 'completion_func=_git_push'
+__git_zsh_bash_func:7> declare -f _git_push
+__git_zsh_bash_func:7> _git_push
+_git_push:2> case origin (--repo)
+_git_push:7> case  (--repo=*)
+_git_push:7> case  (--*)
+_git_push:20> __git_complete_remote_or_refspec
+__git_complete_remote_or_refspec:2> local 'cur_=' 'cmd=push'
+__git_complete_remote_or_refspec:3> local i 'c=2' 'remote=' 'pfx=' 'lhs=1' 'no_complete_refspec=0'
+__git_complete_remote_or_refspec:4> [ push '=' remote ']'
+__git_complete_remote_or_refspec:7> [ 2 -lt 3 ']'
+__git_complete_remote_or_refspec:8> i=origin·
+__git_complete_remote_or_refspec:9> case origin (--mirror)
+__git_complete_remote_or_refspec:9> case origin (--all)
+__git_complete_remote_or_refspec:9> case origin (-*)
+__git_complete_remote_or_refspec:9> case origin (*)
+__git_complete_remote_or_refspec:21> remote=origin·
+__git_complete_remote_or_refspec:21> break
+__git_complete_remote_or_refspec:25> [ -z origin ']'
+__git_complete_remote_or_refspec:29> [ 0 '=' 1 ']'
+__git_complete_remote_or_refspec:32> [ origin '=' . ']'
+__git_complete_remote_or_refspec:33> case  (*:*)
+__git_complete_remote_or_refspec:33> case  (+*)
__git_complete_remote_or_refspec:33: bad pattern: +*
+_dispatch:64> [[ patterns == (all|*patterns*) ]]
+_dispatch:64> return ret
----------------------------8< cut here >8------------------------------



Messages sorted by: Reverse Date, Date, Thread, Author