LibGit2Sharp 中的稀疏结帐

Sparse Checkout in LibGit2Sharp

有没有办法使用 Lib2GitSharp 进行稀疏校验?

我使用 this question(第 2 个答案)作为参考,使用 git bash 手动执行并成功。

问题是在这个答案中执行了命令 'git pull origin master',而在 Lib2GitSharp 中我无法找到完全等效的命令(Repository.Pull() 无法解决问题。 .)

libgit2(因此 LibGit2Sharp)还不支持 稀疏结帐

的确,core.sparsecheckout.git/info/sparse-checkout 的处理还没有实现。您是否愿意跟踪其未来的进展,请在 issue tracker.

中打开一个问题

但是,LibGit2Sharp 公开了一个 CheckoutPaths() 方法,该方法接受路径规范列表(例如 "directory-or-file" , "directory/", "dir/.txt", ...)。您会在下方找到此方法xml文档的摘录

Updates specifed paths in the index and working directory with the versions from the specified branch, reference, or SHA.

This method does not switch branches or update the current repository HEAD.