diff mbox series

[v2] lib/bb/tests/fetch.py: set initial branch

Message ID 20230515064650.261681-1-peter@berginkonsult.se
State Accepted, archived
Commit 5bcd213c23da30a84baba88b775b1740e6bb77d0
Headers show
Series [v2] lib/bb/tests/fetch.py: set initial branch | expand

Commit Message

Peter Bergin May 15, 2023, 6:46 a.m. UTC
From: "Bergin, Peter" <Peter.Bergin@windriver.com>

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'.

Signed-off-by: Peter Bergin <peter.bergin@windriver.com>
Signed-off-by: Peter Bergin <peter@berginkonsult.se>
 lib/bb/tests/fetch.py | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series


diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 532adb941..132cd8e80 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -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):