Local branch named "review" causes "error: unable to resolve reference" error in "git-review -d"

Bug #1096180 reported by Marcin Cieślak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
git-review
New
Undecided
Unassigned

Bug Description

I've had a local branch called "review", unrelated to git-review experience:

$ git branch -vv
* master bea4447 [origin/master] Localisation updates from http://translatewiki.net.
  review c019799 Squashed commit of all RSS changes ported from SVN.

$ git-review -d 3925
Downloading refs/changes/25/3925/8 from gerrit into review/catrope/bug/30377
Cannot checkout to new branch
The following command failed with exit code 128
    "git checkout -b review/catrope/bug/30377 FETCH_HEAD"
-----------------------
error: unable to resolve reference refs/heads/review/catrope/bug/30377: Not a directory
fatal: Failed to lock ref for update: Not a directory
-----------------------

this is because

$ cat .git/refs/heads/review
c019799eea571adb04d71080400aa4715374a0e5

already exists for a local branch.

Conversely, if something is checked out with "git-review -d", it is impossible to have a local branch named "review":

$ git branch -vv
* master bea4447 [origin/master] Localisation updates from http://translatewiki.net.
  review-old c019799 Squashed commit of all RSS changes ported from SVN.

$ git-review -d 3925
Downloading refs/changes/25/3925/8 from gerrit into review/catrope/bug/30377
Switched to branch 'review/catrope/bug/30377'

$ git checkout -b review
error: there are still refs under 'refs/heads/review'
fatal: Failed to lock ref for update: Is a directory

This obviously a limitation of git (especially the latter case) but I believe "git review -d" should be able to do something in this case (workaround or a better diagnostics to the end user)

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.