Patchwork [bitbake-devel,v3] bitbake: fetch2/git: Anchor names when using ls-remote

login
register
mail settings
Submitter Richard Purdie
Date Jan. 20, 2014, 8:46 p.m.
Message ID <1390250783.874.41.camel@ted>
Download mbox | patch
Permalink /patch/65293/
State New
Headers show

Comments

Richard Purdie - Jan. 20, 2014, 8:46 p.m.
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).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---

[Bugfix missing from previous version sent out]

Patch

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index cae1653..d73f0cb 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -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)