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

Paul Eggleton paul.eggleton at linux.intel.com
Thu Jul 9 16:54:48 UTC 2015


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?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the bitbake-devel mailing list