git bash completion for checkout returns only tags

Bug #973791 reported by Richard Laager
This bug report is a duplicate of:  Bug #853081: faulty bash_completion: tags+dirs. Edit Remove
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
git
Unknown
Unknown
git (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The bash completion code for git returns only tags. As a result, substrings that match both tags and filenames will only result in the tag choices being offered, to the exclusion of the filenames. (If the substring matches only filenames, then bash itself will offer the filename completions.)

This is really annoying when you're using git-buildpackage, as you'll have tags of the form debian/... as well as files in a debian/ directory. The bash completion code for git should also return filenames for `git checkout <TAB>`.

Steps to reproduce:
mkdir foo
cd foo
git init
mkdir debian
touch debian/control
git add debian/control
git commit -am "blah"
git tag debian/1.0.0-1
git checkout deb<TAB>

Expected result:
debian/1.0.0-1 debian/control
$ git checkout deb

Actual result:
$ git checkout debian/1.0.0-1

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: git 1:1.7.9.1-1 [modified: usr/bin/git usr/bin/git-upload-pack usr/bin/git-shell usr/lib/git-core/git usr/lib/git-core/git-credential-cache usr/lib/git-core/git-http-backend usr/lib/git-core/git-upload-pack usr/lib/git-core/git-show-index usr/lib/git-core/git-daemon usr/lib/git-core/git-http-fetch usr/lib/git-core/git-credential-store usr/lib/git-core/git-http-push usr/lib/git-core/git-credential-cache--daemon usr/lib/git-core/git-imap-send usr/lib/git-core/git-sh-i18n--envsubst usr/lib/git-core/git-fast-import usr/lib/git-core/git-remote-http usr/lib/git-core/git-shell]
ProcVersionSignature: Ubuntu 3.2.0-21.34-generic 3.2.13
Uname: Linux 3.2.0-21-generic x86_64
NonfreeKernelModules: zfs zcommon znvpair zavl zunicode nvidia
ApportVersion: 2.0-0ubuntu4
Architecture: amd64
Date: Wed Apr 4 16:40:27 2012
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Beta amd64 (20120330)
ProcEnviron:
 TERM=xterm
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: git
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Richard Laager (rlaager) wrote :
dmogle (dmogle)
Changed in git (Ubuntu):
status: New → Confirmed
Revision history for this message
dmogle (dmogle) wrote :
Revision history for this message
dmogle (dmogle) wrote :

Behavior confirmed on Ubuntu 11.10, git 1.7.5.4-1 using steps to reproduce from OP.

Revision history for this message
Maarten Bezemer (veger) wrote :

Bug #853081 is similar: the tags also have preference over the files, but for the git log and git diff commands.

Probably due to the same error in the bash completion script?

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 853081, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.