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

5.0.3 +* -> git completion regression



% git push origin <TAB>
__git_complete_remote_or_refspec:33: bad pattern: +*

Does not occur in a build from 5.0.2, does with 5.0.3; this completion
comes from the git project.

The git project has a _git file which ends up finding a
git-completion.bash file and sourcing that with:

  ZSH_VERSION='' . "$script"

----------------------------8< cut here >8------------------------------
__git_complete_remote_or_refspec ()
{
        local cur_="$cur" cmd="${words[1]}"
[...]
        case "$cur_" in
        *:*)
                case "$COMP_WORDBREAKS" in
                *:*) : great ;;
                *)   pfx="${cur_%%:*}:" ;;
                esac
                cur_="${cur_#*:}"
                lhs=0
                ;;
        +*)
                pfx="+"
                cur_="${cur_#+}"
                ;;
        esac
[...]
----------------------------8< cut here >8------------------------------

That case matching pattern +* is on the 33rd line of the function.

So this appears to be bash not treating the + as special where zsh does.
AFAICT, this seems like perfectly reasonable behaviour on zsh's part,
but nonetheless something which used to work no longer does.

git bisect says this is 68d0d76db55c0b8778f0b68d3eda54060b576c41 :

    31441: use array to decide which forms of pattern are enabled

I think the right approach might be to file a git bug instead, to modify
the _git wrapper from:

  ZSH_VERSION='' . "$script"

to:

  emulate sh -c 'ZSH_VERSION="" . "$script"'

since that fixes it and the zsh behavious appears correct.

Thoughts?  Is there anything which zsh should be doing differently?

-Phil



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