Skip to contentSkip to conversation

[1.24][PATCH] fetch2/git: Allow other namespaces than refs/heads to be searched.

PATCH Fredrik Svensson 1 participant 1 message Jan 6, 2015

lore
Share & tools
lore
#0 lore raw

This makes it possble to fetch Gerrit review references which are normally stored under refs/changes.

---
 lib/bb/fetch2/git.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/bb/fetch2/git.py +4 -1
index 799fb6c..66a77a8 100644
@@ -339,7 +339,10 @@ class Git(FetchMethod):
         """
         Compute the HEAD revision for the url
         """
-        search = "refs/heads/%s refs/tags/%s^{}" % (ud.unresolvedrev[name], ud.unresolvedrev[name])
+        if ud.unresolvedrev[name][:5] == "refs/":
+            search = "%s %s^{}" % (ud.unresolvedrev[name], ud.unresolvedrev[name])
+        else:
+            search = "refs/heads/%s refs/tags/%s^{}" % (ud.unresolvedrev[name], ud.unresolvedrev[name])
         output = self._lsremote(ud, d, search)
         return output.split()[0]
 
Signature · 1 line
1.7.10.4