Override the developer's global git branch name in tests

Setting "main" as a default branch name is getting more common. The
no_commit_to_branch tests depend on this being the default.
This commit is contained in:
Nicholas Devenish 2021-03-04 13:32:47 +00:00
parent 51e14fcc97
commit 31e32bc0af

View file

@ -6,5 +6,12 @@ from pre_commit_hooks.util import cmd_output
@pytest.fixture
def temp_git_dir(tmpdir):
git_dir = tmpdir.join('gits')
cmd_output('git', 'init', '--', str(git_dir))
cmd_output(
'git',
'-c',
'init.defaultBranch=master',
'init',
'--',
str(git_dir),
)
yield git_dir