Skip to contentSkip to conversation

bitbake: fetch2/git: Anchor names when using ls-remote

PATCH Superseded Richard Purdie 1 participant 2 messages Jan 20, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bitbake: fetch2/git: Anchor names when using ls-remote

When specifying tags, they're searched for unanchored so foo/bar could match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads or tags.

---

bitbake/lib/bb/fetch2/git.py +1 -1
index ed55f43..3620143 100644
@@ -326,7 +326,7 @@ class Git(FetchMethod):
         else:
             username = ""
 
-        cmd = "%s ls-remote %s://%s%s%s %s^{}" % \
+        cmd = "%s ls-remote %s://%s%s%s refs/heads/%s^{} refs/tags/%s^{}" % \
               (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
         if ud.proto.lower() != 'file':
             bb.fetch2.check_network_access(d, cmd)
#1 lore raw

PATCH v3 1/1 bitbake: fetch2/git: Anchor names when using ls-remote

When specifying tags, they're searched for unanchored so foo/bar could match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads or tags (or any other base level tree that has been created).

---

[Bugfix missing from previous version sent out]

bitbake/lib/bb/fetch2/git.py +2 -2
index cae1653..d73f0cb 100644
@@ -326,8 +326,8 @@ class Git(FetchMethod):
         else:
             username = ""
 
-        cmd = "%s ls-remote %s://%s%s%s %s" % \
-              (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
+        cmd = "%s ls-remote %s://%s%s%s refs/heads/%s refs/tags/%s" % \
+              (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name], ud.unresolvedrev[name])
         if ud.proto.lower() != 'file':
             bb.fetch2.check_network_access(d, cmd)
         output = runfetchcmd(cmd, d, True)