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):