All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bitbake: bb.fetch2.git: Fix _latest_revision function while using tags
@ 2014-01-05  1:53 Andrei Gherzan
  2014-01-07 10:36 ` Olof Johansson
  2014-01-07 13:38 ` Richard Purdie
  0 siblings, 2 replies; 8+ messages in thread
From: Andrei Gherzan @ 2014-01-05  1:53 UTC (permalink / raw)
  To: bitbake-devel

When getting the revision we must take into consideration if the name we are
looking for is a tag and in that case we need the dereferenced commit ID in
order to check for it existance in a specific branch.

So first search for the reference^{} commit ID and only if that returns nothing
get the name as it is.

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
---
 bitbake/lib/bb/fetch2/git.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index b4b9368..1584232 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -318,9 +318,13 @@ class Git(FetchMethod):
               (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
         if ud.proto.lower() != 'file':
             bb.fetch2.check_network_access(d, cmd)
-        output = runfetchcmd(cmd, d, True)
+        # Maybe the ref is a tag so try to dereference it first
+        output = runfetchcmd(cmd + '^{}', d, True)
         if not output:
-            raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url)
+            # Dereference gave nothing so try to get it as it is
+            output = runfetchcmd(cmd, d, True)
+            if not output:
+                raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url)
         return output.split()[0]
 
     def _build_revision(self, ud, d, name):
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-07 17:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-05  1:53 [PATCH] bitbake: bb.fetch2.git: Fix _latest_revision function while using tags Andrei Gherzan
2014-01-07 10:36 ` Olof Johansson
2014-01-07 13:40   ` Richard Purdie
2014-01-07 14:46     ` Olof Johansson
2014-01-07 15:02       ` Richard Purdie
2014-01-07 15:48         ` Olof Johansson
2014-01-07 17:18           ` Andrei Gherzan
2014-01-07 13:38 ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.