no-commit-to-branch: Default to both master and main

This commit is contained in:
Nicholas Devenish 2021-03-04 13:41:04 +00:00
parent 51e14fcc97
commit 3abbd4785c
3 changed files with 9 additions and 2 deletions

View file

@ -67,3 +67,10 @@ def test_not_on_a_branch(temp_git_dir):
cmd_output('git', 'checkout', head)
# we're not on a branch!
assert main(()) == 0
@pytest.mark.parametrize('branch_name', ('master', 'main'))
def test_default_branch_names(temp_git_dir, branch_name):
with temp_git_dir.as_cwd():
cmd_output('git', 'checkout', '-b', branch_name)
assert main(()) == 1