Skip to contentSkip to conversation

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

PATCH New [email protected] 1 participant 1 message May 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 lib/bb/tests/fetch.py: set initial branch

From: "Bergin, Peter" <[email protected]>

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

---
 lib/bb/tests/fetch.py | 4 ++++
 1 file changed, 4 insertions(+)
lib/bb/tests/fetch.py +4 -0
index 532adb941..132cd8e80 100644
@@ -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', '[email protected]'], cwd=cwd)
         if not self.git(['config', 'user.name'], cwd=cwd):
Signature · 1 line
2.34.1