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