Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#62830 - [git] Install the project's zsh completion

Attached to Project: Arch Linux
Opened by Felipe Contreras (felipec) - Thursday, 06 June 2019, 19:58 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 22 July 2019, 02:44 GMT
Task Type Feature Request
Category Packages: Extra
Status Assigned
Assigned To Christian Hesse (eworm)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

It would be nice if the package distributed the official completions for zsh:

# zsh completion
mkdir -p "$pkgdir"/usr/share/zsh/site-functions/
install -m 0644 ./contrib/completion/git-completion.zsh "$pkgdir"/usr/share/zsh/site-functions/_git

Most people would want these completions for several reasons:

1. They are blessed by Git developers
+ They are way faster
+ They are constantly up-to-date
+ They are developed by more people
+ They actually have tests; lost of them

There's only one drawback:

1. Not all the completions have help

I could go deeper and list many reasons why these completions are superior if anybody is interested.

But I think if all you need to do is look at the [tests for Git](https://git.kernel.org/pub/scm/git/git.git/plain/t/t9902-completion.sh), and then look at the tests for [Zsh](http://dev.com/null).

If you need more reasoning, here's a list of testimonials:

* [Finally fed up with terribly slow auto-completion in zshell and starting looking a solution.](https://stackoverflow.com/questions/9810327/zsh-auto-completion-for-git-takes-significant-amount-of-time-can-i-turn-it-off/19572542#19572542)
* [Solved: ZSH tab completion painfully slow](http://blog.victorquinn.com/solved-zsh-tab-completion-painfully-slow)
* [zsh git command auto-complete add extra origin to the git branch name](https://unix.stackexchange.com/questions/187630/zsh-git-command-auto-complete-add-extra-origin-to-the-git-branch-name)
* [ZSH tab completion of git commands is very slow. How can I turn it off?](https://superuser.com/questions/458906/zsh-tab-completion-of-git-commands-is-very-slow-how-can-i-turn-it-off)

Disclaimer: I've been working on these for several years, so I'm slightly biased.
This task depends upon

Comment by Felipe Contreras (felipec) - Thursday, 06 June 2019, 20:00 GMT
Sorry about the format, I thought there was markup.
Comment by Christian Hesse (eworm) - Monday, 22 July 2019, 15:38 GMT
At the same time we should remove the completion files for git from zsh, no?
Comment by 이찬규 (ycg1221) - Friday, 06 December 2019, 07:34 GMT
As far as I can see, git completion from the zsh itself is more complete and up-to-date with more options included. Some part of it is just not released yet, but still reflects more recent version of the git than the completion included in the git package. That from git doesn't get updated accordingly with its version. Also I don't see any noticeable performance hit from my side.
Comment by 이찬규 (ycg1221) - Friday, 06 December 2019, 07:56 GMT
That testcase you linked is only for bash completion.
Comment by thayne (ender4) - Monday, 27 January 2020, 08:22 GMT
from what I can tell zsh completion packaged with git is just a wrapper around the bash completion, and as such doesn't have many of zsh completion's special features. And if users do prefer git's completion, they have the option of using the /usr/share/git/completion/git-completion.zsh file that is distributed with git. However, the git completion distributed with zsh _is_ out of date. Notably, it is missing completion for the new switch and restore commands. I wonder if it would make sense to update zsh completions more frequently than the rest of the zsh package, since software that the completions are for can update more frequently than zsh itself. Maybe split zsh core completions out into a separate package?
Comment by Felipe Contreras (felipec) - Saturday, 29 February 2020, 02:09 GMT
@ycg1221 No, it's actually the other way around. The git version is *always* more up-to-date than the zsh version. As I already said.

Also. The git version is blessed by git developers. It's much faster and reliable than the zsh version.

The completion files from zsh should not be removed, in case the user prefers that version.

@ender4 Yes, some features of the zsh completion are not present, but it does have the most important feature: it's actually usable.

The zsh completion for git is so slow that you can google 'zsh completion git slow' and you will have tons of people looking for a way to make them faster. The zsh project is not interested in making their completion usable.

That's why projects like oh-my-zsh have plugins like 'gitfast' which do use the git completions which I helped to create.

The issue you mentioned about missing commands would always work with the git completions, since they use the helper `git --list-cmds=`, so as soon as a new command is introduced it will show up in the completions. Not to mention that the completions would be synchronized with the git version, since it's they the ones that provide them.
Comment by 이찬규 (ycg1221) - Monday, 02 March 2020, 00:50 GMT
@felipec Well, as I vaguely mentioned I was talking about unreleased development version of zsh. And on the last month it was released, so actually zsh version is more up to date than git version now. git version is still out-of-date and untouched for months living it out-of-sync with features from the latest git release. Commit history also shows that it is not very activley maintained.

Loading...