[oe-commits] [bitbake] 02/03: fetch2/git.py: References must match exactly

git at git.openembedded.org git at git.openembedded.org
Thu Jun 2 21:15:34 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit e5986c78a6108fd7578989c20efcbf0b81c97e03
Author: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
AuthorDate: Mon May 23 13:35:49 2016 +0200

    fetch2/git.py: References must match exactly
    
    Previously the code used to match a reference to its SHA-1 in
    _latest_revision() used the Python "in" operator, which made it match
    if the reference matched the beginning of an existing tag or
    branch. This test, however, must be exact. I.e., either the reference
    matches a tag or branch exactly, or it does not match at all.
    
    Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 526668b..59827e3 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -350,9 +350,10 @@ class Git(FetchMethod):
             head = "refs/heads/%s" % ud.unresolvedrev[name]
             tag = "refs/tags/%s" % ud.unresolvedrev[name]
         for s in [head, tag + "^{}", tag]:
-            for l in output.split('\n'):
-                if s in l:
-                    return l.split()[0]
+            for l in output.strip().split('\n'):
+                sha1, ref = l.split()
+                if s == ref:
+                    return sha1
         raise bb.fetch2.FetchError("Unable to resolve '%s' in upstream git repository in git ls-remote output for %s" % \
             (ud.unresolvedrev[name], ud.host+ud.path))
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list