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

Robert Yang liezhi.yang at windriver.com
Fri Jul 10 00:00:35 UTC 2015



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.

// Robert

>
> Cheers,
> Paul
>



More information about the bitbake-devel mailing list