1

Is there a way to do sparse checkout with Lib2GitSharp?

I used this question (2nd answer) as a reference, executed it manually with git bash and it worked.

The problem is that in this answer the command 'git pull origin master' is executed, and in the Lib2GitSharp I wasn't able to find an exact equivalent (Repository.Pull() does not do the trick..)

Community
  • 1
  • 1
Guy Segal
  • 953
  • 1
  • 12
  • 24

1 Answers1

0

libgit2 (and thus LibGit2Sharp) doesn't support sparse checkout yet.

Indeed, handling of core.sparsecheckout and .git/info/sparse-checkout is not implement yet. Would you be willing to keep track of its future progress, please open a issue in the issue tracker.

However, LibGit2Sharp exposes a CheckoutPaths() method which accepts a list of pathspecs (eg. "directory-or-file", "directory/", "dir/.txt", ...). You'll find below an excerpt of the xml doc of this method

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.

nulltoken
  • 64,429
  • 20
  • 138
  • 130