bitbake: lib/bb/tests/fetch.py: set initial branch

If you have a host where the git config for initial branch
name is something else than 'master' the unittest will fail
as they assume the default branch name is 'master'. Fix this
by explicitly set the intial branch name at 'git init'.

(Bitbake rev: 5bcd213c23da30a84baba88b775b1740e6bb77d0)

Signed-off-by: Peter Bergin <peter.bergin@windriver.com>
Signed-off-by: Peter Bergin <peter@berginkonsult.se>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Bergin, Peter
2023-05-15 08:46:50 +02:00
committed by Richard Purdie
parent 222c5668a6
commit 5c3b6b6fd1

View File

@@ -424,6 +424,10 @@ class FetcherTest(unittest.TestCase):
def git_init(self, cwd=None):
self.git('init', cwd=cwd)
# Explicitly set initial branch to master as
# a common setup is to use other default
# branch than master.
self.git(['checkout', '-b', 'master'], cwd=cwd)
if not self.git(['config', 'user.email'], cwd=cwd):
self.git(['config', 'user.email', 'you@example.com'], cwd=cwd)
if not self.git(['config', 'user.name'], cwd=cwd):