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

Re: Strange behavior about option completion of `git push`



Yasuhiro KIMURA wrote:
> Next let's type `git push --f' and hit TAB. In this case options that
> start with `--f' are `--follow-tags`, `--force` and
> `--force-with-lease` and all of them start with `--fo`. So expected
> behavior is that it will be completed as `git push --fo`. But what
> really happens is that there is no change after TAB is hit.

This appears to be a bug in the zsh completion internals. The difference
between --f and --r is that for --f, the options are added with more
than one call to compadd because there's a mix of suffix characters
required on those options.

Any further discussion on this line should probably go to -workers but a
minimal function to reproduce the issue is as follows:

  compadd -M 'r:|.=*' one
  compadd -M 'r:|-=*' - --follow-tags --force
  compadd -M 'r:|-=*' - --force-with-lease
  return 0

With _git_push the first of these compadd calls is from _ssh_hosts. The
matching control options are needed. The latter two with - as a pivot
but the first can use any character. The case with --r is equivalent to
combining the latter two compadd calls into a single call.

Matching control is known to have some gnarly issues.

Oliver




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