git reset --hard should be given either commit id or
origin/<ref name> to work properly. Without this fix git will
complain that origin/<commit id> does not exist.

[YOCTO #7505]

Signed-off-by: Ed Bartosh <[email protected]>
---
 bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py 
b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index 42be4af..0c34957 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -266,7 +266,8 @@ class LocalhostBEController(BuildEnvironmentController):
             # branch magic name "HEAD" will inhibit checkout
             if commit != "HEAD":
                 logger.debug("localhostbecontroller: checking out commit %s to 
%s " % (commit, localdirname))
-                self._shellcmd('git fetch --all && git reset --hard 
"origin/%s"' % commit, localdirname)
+                ref = commit if re.match('^[a-fA-F0-9]+$', commit) else 
'origin/%s' % commit
+                self._shellcmd('git fetch --all && git reset --hard "%s"' % 
ref, localdirname)
 
             # take the localdirname as poky dir if we can find the 
oe-init-build-env
             if self.pokydirname is None and 
os.path.exists(os.path.join(localdirname, "oe-init-build-env")):
-- 
2.1.4

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to