zsh-workers
 help / color / mirror / code / Atom feed
From: "Marc Cornellà" <marc.cornella@live.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: [BUG] git checkout completion shows duplicated branch names
Date: Mon, 24 Sep 2018 14:51:29 +0000	[thread overview]
Message-ID: <AM0P195MB03370F6E436A8BA5D4ECE09D84170@AM0P195MB0337.EURP195.PROD.OUTLOOK.COM> (raw)

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

             reply	other threads:[~2018-09-24 14:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 14:51 Marc Cornellà [this message]
2018-09-24 16:04 ` Daniel Shahaf
2018-09-24 18:00   ` Daniel Shahaf
2018-09-25  0:24     ` Bart Schaefer
2018-09-25 16:50       ` Daniel Shahaf
2018-09-25  0:46     ` Oliver Kiddle
2018-09-25 16:43       ` Daniel Shahaf
2018-09-25 17:15         ` Bart Schaefer
2018-09-25 17:28           ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0P195MB03370F6E436A8BA5D4ECE09D84170@AM0P195MB0337.EURP195.PROD.OUTLOOK.COM \
    --to=marc.cornella@live.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).