On Wed, Sep 1, 2021 at 4:56 PM Daniel Shahaf wrote: > > Marlon Richert wrote on Mon, Aug 30, 2021 at 14:17:17 +0300: > > In _git-show, remove calls to __git_commits and __git_tags. > > Rationale: 'commits' and 'tags' are already added by __git_trees. > > Adding them twice makes `zstyle ... tag-order` give unexpected > > results. > > > > Complete example, please? Before the patch, setting `zstyle '*' tag-order '! commit-tags heads-remote'` failed to hide 'commit-tags' and 'heads-remote' from `git show` completion. After the patch, this works correctly and will show 'commit-tags' or 'heads-remote' only if other tags produce no matches. > > > In __git_recent_commits, remove the line that adds 'heads'. > > Rationale: The completion for most subcommands already adds > > 'heads-local' and 'heads-remote'. Adding an additional 'heads' inside > > __git_recent_commits results in heads being listed twice in two > > separate groups. > > Complete example, please? Before the patch, `git log` completion listed groups 'local head', 'remote head', then other groups, and then group 'head', which repeated items from the first two groups. After the patch, the last group is omitted. > Also, what about those subcommands that > *don't* already add heads-local and heads-remote? Good observation. Those would be the completion functions for `git commit --fixup`, `git commit --squash`, `git revert` and `git send-email`. My patch tried to handle that case, too, but some more testing revealed that it didn't work correctly. Here is a new patch that fixes this by making these four completions use __git_commits, which prefers recent commits and tags, but can also complete any other commits, tags or heads.