Commit 8fababe1 authored by Jérome Perrin's avatar Jérome Perrin

tests: set branch name when initializing git repositories

prevent these warnings to pollute the output:

hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
parent cff45572
...@@ -152,7 +152,7 @@ class GitCloneNonInformativeTests(TestCase): ...@@ -152,7 +152,7 @@ class GitCloneNonInformativeTests(TestCase):
os.mkdir(self.project_dir) os.mkdir(self.project_dir)
# Add files and folder in parent repo and initialize git in it # Add files and folder in parent repo and initialize git in it
check_call(['git', 'init'], cwd=self.project_dir) check_call(['git', 'init', '--initial-branch', 'main'], cwd=self.project_dir)
self.setUpGitConfig(self.project_dir) self.setUpGitConfig(self.project_dir)
os.mkdir(os.path.join(self.project_dir, 'dir1')) os.mkdir(os.path.join(self.project_dir, 'dir1'))
self.touch(self.project_dir, 'file1.py') self.touch(self.project_dir, 'file1.py')
...@@ -169,7 +169,7 @@ class GitCloneNonInformativeTests(TestCase): ...@@ -169,7 +169,7 @@ class GitCloneNonInformativeTests(TestCase):
os.mkdir(self.submodule_dir) os.mkdir(self.submodule_dir)
# Add files in submodule repo and initialize git in it # Add files in submodule repo and initialize git in it
check_call(['git', 'init'], cwd=self.submodule_dir) check_call(['git', 'init', '--initial-branch', 'main'], cwd=self.submodule_dir)
self.setUpGitConfig(self.submodule_dir) self.setUpGitConfig(self.submodule_dir)
self.touch(self.submodule_dir, 'file1.py') self.touch(self.submodule_dir, 'file1.py')
self.gitAdd(self.submodule_dir) self.gitAdd(self.submodule_dir)
...@@ -356,7 +356,7 @@ repository = %s ...@@ -356,7 +356,7 @@ repository = %s
# pointer on parent repo and commit it # pointer on parent repo and commit it
submodule_dir_main_repo = os.path.join(self.project_dir, 'dir1', submodule_dir_main_repo = os.path.join(self.project_dir, 'dir1',
'submodule_repo') 'submodule_repo')
check_call(['git', 'checkout', 'master'], cwd=submodule_dir_main_repo) check_call(['git', 'checkout', 'main'], cwd=submodule_dir_main_repo)
check_call(['git', 'pull', '--ff'], cwd=submodule_dir_main_repo) check_call(['git', 'pull', '--ff'], cwd=submodule_dir_main_repo)
self.gitAdd(self.project_dir) self.gitAdd(self.project_dir)
self.gitCommit(self.project_dir, msg='Update submodule version') self.gitCommit(self.project_dir, msg='Update submodule version')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment