From 31e32bc0af8113c47387236f829fc293fadbabd0 Mon Sep 17 00:00:00 2001 From: Nicholas Devenish Date: Thu, 4 Mar 2021 13:32:47 +0000 Subject: [PATCH] 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. --- tests/conftest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index f92cfc1..20842b1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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