zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh-workers@zsh.org
Subject: Re: 5.0.3 +* -> git completion regression
Date: Mon, 16 Dec 2013 05:37:26 -0500	[thread overview]
Message-ID: <20131216103726.GA25715@redoubt.spodhuis.org> (raw)
In-Reply-To: <20131216094700.2c5edd2a@pwslap01u.europe.root.pri>

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@spodhuis.org> 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------------------------------


  reply	other threads:[~2013-12-16 10:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16  8:14 Phil Pennock
2013-12-16  9:47 ` Peter Stephenson
2013-12-16 10:37   ` Phil Pennock [this message]
2013-12-16 15:56     ` Bart Schaefer
2013-12-16 22:08     ` Peter Stephenson
2013-12-17 17:48       ` Phil Pennock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131216103726.GA25715@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).