1
votes

I'm using libgit2sharp in a .net application. I would like to fetch a directory from github. I can do this now by cloning the entire directory using Repository.Clone. But it takes a long time, and I'm fetching more files than I need. For instance the .git-repository and also a number of folders that I'm not interested in.

Is there a way that I can export a single folder from a git repository using libgit2sharp? Or should I do this in another way?

1

1 Answers

0
votes

Git doesn't support a partial pull (ie. retrieving only one folder).

However, git allows to not retrieve the whole history of a repository, but a truncated version of it, only containing the n latest revision. This operation is known as a shallow clone.

There's currently no shallow clone support in libgit2/LibGit2Sharp. Yet.

However, it will eventually be supported. A feature request has even been opened in the LibGit2Sharp issue tracker. You can track the progress by subscribing to issue 229