Git 选项卡完成停止在远程分支上工作

Git tab completion stopped working on remote branches

我已将 git 更新到最新版本 (2.29.0),并且我使用的是 ZSH 5.8。

我以前用git checkout remote_br<tab> switch between branches来快速切换分支,即使分支只是一个远程的atm。我已经看到 git 对 switch/checkout recently 做了很多更改,问题是我在远程分支上的自动完成功能不再工作(通过结帐或切换)。

我已尝试将最新版本的 contrib/completion/git-completion.zsh 添加到我的 zsh,但我仍然遇到问题。我在这里遗漏了什么吗?

过去几个小时我一直在研究这个问题并确定了回归。

回归发生在6880779

临时解决此问题:将您的 git-completion.bash 文件(我的位于 /usr/local/share/zsh/site-functions/git-completion.bash)替换为 https://github.com/git/git/blob/688077910bdfbd502cb59c9c48a2af2c97d8b67b~1/contrib/completion/git-completion.bash

要真正解决这个问题,请给我投票 git PR and help get it merged! (https://github.com/git/git/pull/902)

尝试以下补丁:

--- a/git-completion.zsh
+++ b/git-completion.zsh
@@ -97,6 +97,11 @@ __gitcomp_direct ()
        compadd -Q -S '' -- ${(f)1} && _ret=0
 }
 
+__gitcomp_direct_append ()
+{
+       __gitcomp_direct "$@"
+}
+
 __gitcomp_nl ()
 {
        emulate -L zsh

一般来说,最好向 git mailing list, however, I'm the maintainer of the zsh code, which is more up to date in my fork: git-completion 报告错误。