Search code examples
gitlibgit2libgit2sharp

Fetch single commit with LibGit2[Sharp]


How can I do the equivalent of git fetch origin <CommitHash> with LibGit2Sharp?

It seems the only relevant option for git_remote_fetch are the refspecs so I imagine I need some trickery there, but I don't see how from the documentation.

The idea is to fetch only the data required and not everything from the remote since the repo is a shallow clone.


Solution

  • Although libgit2 implemented shallow cloning in v1.7.0, it hasn't surfaced in Libgit2Sharp yet.

    The issue to subscribe to in order to follow up on the feature request is #229.