libgit2 / libgit2/libgit2sharp
Commands.Stage() fails with a submodule
未关闭
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 3.5k
- 派生
- 925
- PR 合并指标
- 30 天内没有已合并 PR
描述
Reproduction steps
- Add a submodule to a Git repository like
git submodule add ../test-module test-module - Change the commit of the submodule like
cd test-module; git checkout -b branch-name - Try to stage the submodule using libgit2sharp with
Commands.Stage("*")or withCommands.Stage("test-module")
Expected behavior
The submodule change should be staged.
Actual behavior
An exception is thrown because git_index_add_bypath() failed because the path is invalid: test-module/
Commands.Stage() adds a slash at the end of the submodule name it passes to git_index_add_bypath which causes it to fail. git_index_add_bypath works fine passing it test-module directly with repo.Index.Add("test-module") (which is a workaround I'll use for now).
Version of LibGit2Sharp (release number or SHA1)
LibGit2Sharp 0.26.2
Operating system(s) tested; .NET runtime tested
.NET Framework 4.7.2 on Windows 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Commands.Stage 入口点开始,使用 Commands.Stage("*") 和 Commands.Stage("test-module") 重现所述的子模块情况。将其路径处理与被报告为 workaround 的 repo.Index.Add("test-module") 进行比较。完成标准是能够在没有尾部斜杠路径错误的情况下暂存已更改的子模块。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, git
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100