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

Paul Eggleton paul.eggleton at linux.intel.com
Fri Jul 10 09:04:49 UTC 2015


On Friday 10 July 2015 08:00:35 Robert Yang wrote:
> On 07/10/2015 12:54 AM, Paul Eggleton wrote:
> > On Thursday 09 July 2015 00:18:01 Robert Yang wrote:
> >> * 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)
> > 
> > Doesn't git checkout support a --track option so we could do this in one
> > command rather than two?
> 
> I'm afraid that we can use --track here, the supported commands are:
> git checkout -b <branch> --track <remote>/<branch>
> or
> git checkout -b <branch> <start point>
> 
> What we need is something like:
> git checkout -b <branch> --track <remote>/<branch> <start point>
> but git doesn't support this.

Ah ok, fair enough - thanks for checking.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the bitbake-devel mailing list