libgit2 / libgit2/libgit2sharp
How to control the name of the default branch from Repository.Init?
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 3.5k
- 派生
- 925
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查 Repository.Init(string),以及 issue 中关于 .git/HEAD 和首次提交时创建分支的讨论。确定现有 API 是否提供选择初始分支名称的方式;当新仓库能够在不同机器上始终使用所请求的默认分支,并且初始化行为有测试覆盖时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, git
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100