idwanglu2010 / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 0 forks source link

When project revision is a tag, ToLocal() incorrectly converts to refs/remotes/... #192

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version: v1.12.16
Environment: Ubuntu 14.04.1, git 2.1.3

To reproduce:
1. Modify project revision in manifest.xml to be a tag
2. repo init -m manifest.xml

Expected output:
Fetching project <project name>
Fetching projects: 100%

Instead I see:
Fetching project <project name>
error: in `sync`: revision <revision name> in <project name> not found

Tracing through .repo/repo/project.py, I found that GetRevisionId() is 
transforming self.revisionExpr with Remote.ToLocal(). In my case, this 
produces: '<revision name>' -> 'refs/remotes/<remote name>/<revision name>', 
which is not found in the all_refs dictionary. However the dictionary *does* 
have the tag in question, formatted as 'refs/tags/<revision name>'.

I'm pretty sure the "bug" is really in Remote.ToLocal(), but I've found a 
work-around that works for me is to manually prepend 'refs/remotes/' (using the 
R_TAGS global) to self.revisionExpr and trying again to find it in all_tags. 
See attached patch.

Original issue reported on code.google.com by j...@sroz.net on 14 Jan 2015 at 12:54

Attachments: