8000 How to control the name of the default branch from Repository.Init? · Issue #1964 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content
How to control the name of the default branch from Repository.Init? #1964
@AArnott

Description

@AArnott

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0