Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] git checkout completion shows duplicated branch names
- X-seq: zsh-workers 43529
- From: Marc Cornellà <marc.cornella@xxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: [BUG] git checkout completion shows duplicated branch names
- Date: Mon, 24 Sep 2018 14:51:29 +0000
- Accept-language: ca-ES, en-US
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=marc.cornella@xxxxxxxx;
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Thread-index: AQHUVBYT4dNpjPA5BUWq47HfvxopfQ==
- Thread-topic: [BUG] git checkout completion shows duplicated branch names
Steps to reproduce:
git init repo
cd repo
git commit --allow-empty -m 'Initial commit'
git checkout -b topic/foo
git checkout master
Now, when trying to complete to a branch name, here's what I see:
~/repo% git checkout <TAB>
e287376 -- [HEAD] Initial commit (12 seconds ago)
topic/foo master -- Initial commit
HEAD master
topic/foo
Notice that branches appear twice. This only happens on versions newer
than 5.3.1, excluding this one.
A `git bisect` pointed me to commit e869952, which changed to using
the __git_recent_branches function,
which uses extracts branch names from the git reflog.
Furthermore, on versions prior to commit 4dddf3aa (< zsh-5.6), the
completion is even worse since a branch
is not fully completed even if there isn't any other branch with the
same prefix.
So typing this:
~/repo% git checkout topic/<TAB>
topic/foo -- Initial commit
topic/foo
gets completed to `git checkout topic` instead of the full branch name.
So after version 5.6 and newer the bug is not that annoying because
the full branch name is indeed completed,
but there're still duplicated entries and I'd expect there to be
unique branch names.
If I knew enough about the completion system I would try to fix it,
but sometimes you have to let the hard stuff
to the pros.
Thanks,
Marc
Messages sorted by:
Reverse Date,
Date,
Thread,
Author