I have automated test failures due to Repository.Init(string) creating repos with main as the default branch name instead of master. How can I control the name of the default branch for a new repository so that my tests pass consistently across machines?
I tried using libgit2sharp APIs to create a new branch and deleting the old, but in fact on a brand new repository, there is no branch and no commit, so I guess the default branch is just the name that HEAD will use for a new branch once the first commit is authored. It appears this is stored in .git/HEAD. Is there an API to help us rewrite that file, perhaps?