Skip to content

Commit b7ed756

Browse files
committed
Create the test repos with --initial-branch=master
git prints a warning when creating a new repository if `init.defaultBranch` is not configured and `git init` is called without `--initial-branch`. Furthermore, several tests expect the initial branch to be `master`. Those tests will fail if the default configuration for the default branch ever changes. Therefore, the repositories created for testing are explicitly configured to use the initial branch `master`.
1 parent 7b1e4b6 commit b7ed756

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/darker/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def create_repository(cls, root: Path) -> "GitRepoFixture":
2525
env = {"HOME": str(root), "LC_ALL": "C", "PATH": os.environ["PATH"]}
2626
instance = cls(root, env)
2727
# pylint: disable=protected-access
28-
instance._run("init")
28+
instance._run("init", "--initial-branch=master")
2929
instance._run("config", "user.email", "[email protected]")
3030
instance._run("config", "user.name", "CI system")
3131
return instance

0 commit comments

Comments
 (0)