[bitbake-devel] [PATCH 1/1] git.py: create a branch when checkout

Robert Yang liezhi.yang at windriver.com
Thu Jul 9 07:18:01 UTC 2015


* Create a branch and named as upstream branch when checkout source
* Set the branch to track remote branch.

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 bitbake/lib/bb/fetch2/git.py |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 2e53882..afa3d0a 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):
-- 
1.7.9.5




More information about the bitbake-devel mailing list