From 518abb731ce27a606f0a17c26b324b9d57abfe18 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Thu, 9 Jul 2015 00:18:01 -0700 Subject: bitbake: git.py: create a branch when checkout * Create a branch and named as upstream branch when checkout source * Set the branch to track remote branch. (Bitbake rev: 1ba20e4fe9c884515b200589fe379ad5eeda10bd) Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/git.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bitbake/lib/bb/fetch2/git.py') diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 0abd67924b..31fd8a7206 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -279,8 +279,15 @@ class Git(FetchMethod): if subdir != "": runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d) runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d) + elif not ud.nobranch: + branchname = ud.branches[ud.names[0]] + runfetchcmd("%s checkout -B %s %s" % (ud.basecmd, branchname, \ + ud.revisions[ud.names[0]]), d) + runfetchcmd("%s branch --set-upstream %s origin/%s" % (ud.basecmd, branchname, \ + branchname), d) else: runfetchcmd("%s checkout %s" % (ud.basecmd, ud.revisions[ud.names[0]]), d) + return True def clean(self, ud, d): -- cgit v1.2.3-54-g00ecf