Skip to contentSkip to conversation

bitbake: fetch2/git: Allow HEAD to be searched.

PATCH In review Mariano Lopez 2 participants 2 messages Apr 27, 2015 – Apr 28, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake: fetch2/git: Allow HEAD to be searched.

This makes it possble to fetch/search HEAD. This is useful when searching for HEAD doing the sanity check.

Please disregard previous patch with the same topic.

[YOCTO #7592]

---
 bitbake/lib/bb/fetch2/git.py | 3 +++
 1 file changed, 3 insertions(+)
bitbake/lib/bb/fetch2/git.py +3 -0
index 0d91431..12fb6a2 100644
@@ -345,6 +345,9 @@ class Git(FetchMethod):
         if ud.unresolvedrev[name][:5] == "refs/":
             head = ud.unresolvedrev[name]
             tag = ud.unresolvedrev[name]
+        elif ud.unresolvedrev[name] == "HEAD":
+            head = ud.unresolvedrev[name]
+            tag = ud.unresolvedrev[name]
         else:
             head = "refs/heads/%s" % ud.unresolvedrev[name]
             tag = "refs/tags/%s" % ud.unresolvedrev[name]
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 17 lines · Mariano Lopez

This makes it possble to fetch/search HEAD. This is useful when searching for HEAD doing the sanity check.

Please disregard previous patch with the same topic.

[YOCTO #7592]

---
  bitbake/lib/bb/fetch2/git.py | 3 +++
  1 file changed, 3 insertions(+)
bitbake/lib/bb/fetch2/git.py +0 -0
index 0d91431..12fb6a2 100644

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 353

Quoted 9 lines
bitbake/lib/bb/fetch2/git.py +3 -0
@@ -345,6 +345,9 @@ class Git(FetchMethod):
          if ud.unresolvedrev[name][:5] == "refs/":
              head = ud.unresolvedrev[name]
              tag = ud.unresolvedrev[name]
+        elif ud.unresolvedrev[name] == "HEAD":
+            head = ud.unresolvedrev[name]
+            tag = ud.unresolvedrev[name]
          else:
              head = "refs/heads/%s" % ud.unresolvedrev[name]
              tag = "refs/tags/%s" % ud.unresolvedrev[name]

Looking at the bug, I think the example in poky.conf needs fixing not to use HEAD rather than this patch.

I'd also mention that you could do:

if ud.unresolvedrev[name][:5] == "refs/" or ud.unresolvedrev[name] == "HEAD":

rather than duplicate code. The whitespace in this patch is also broken.

Cheers,

Richard