libgit2sharp
libgit2sharp copied to clipboard
Commands.Stage() fails with a submodule
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