bitbake: toaster: fix bug in resetting git repository

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]

(Bitbake rev: ec05beff7d1b06e4df98199925c7102f5684f4e0)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh 2015-09-23 15:34:55 -07:00 committed by Richard Purdie
parent 693934031a
commit 55dc9279c8
1 changed files with 2 additions and 1 deletions

View File

@ -268,7 +268,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")):