libgit2sharp , Support of custom backends in libgit2sharp bindings

Support of custom backends in libgit2sharp bindings


Tag: libgit2sharp

Does libgit2sharp support custom backend configuration (similar to


Indeed, libgit2 exposes the concepts of pluggable backends: There are 3 of them: object database, reference database and configuration storage.

From the LibGit2sharp latest release (v0.21) standpoint:

This is discussed further in an open LibGit2Sharp feature request (Add In-Memory Repository Support).


List commits that are reachable by following the parent links from the given commit (like `git rev-list`)

Is there a way to list all commits that are reachable from HEAD using libgit2sharp library like git rev-list HEAD do? There is a function ReferenceCollectionException.ReachableFrom, but it returns the list of refs pointed at particular commit: let repo = new Repository("C:\path\to\repo") let c = repo.Lookup<Commit>("HEAD") let commits = repo.Refs.ReachableFrom([c])...

Searching file in branch

I'm trying to get functionality to search for file in all branches. For example I have 10 branches and I need to get all different version of that file (to look it, compare or more, for example I could have many personalized documents for clients, .css files, source files with...

libgit2sharp unable to do a repository push - Unable to evaluate expression because the code is optimized

When debugging using the repository Network object the quick watch of the instance tells me all threads need to be running, which causes the message in the title. Not sure why this is the case but when doing the push I get that message. This real issue here is why...

Get files modified/added/removed from a commit in LibGit2Sharp

I've this method, where I get files from my last commit: static void GetFiles(Tree t, String dir = "") { foreach (TreeEntry treeEntry in t) { if (treeEntry.TargetType == TreeEntryTargetType.Tree) { Tree tr = repo.Lookup<Tree>(treeEntry.Target.Sha); GetFiles(tr, dir + "/" + treeEntry.Name); } else { string caminho = dir + "/"...

LibGit2Sharp get repository changes after pull

How can i get the following information after a git-pull with libgit2sharp: Which files has been moved Which files has been created Which files has been deleted The git-pull request it self works perfectly: var result = repo.Network.Pull(new LibGit2Sharp.Signature("admin", "[email protected]", new DateTimeOffset(DateTime.Now)), options); I already looked at the result of...

Read the files at the spesific commit with libgit2sharp

There is a bare repository, I have a commit id, and want to read all the files at that commit without cloning. This repository.Lookup<Tree>(repository.Commits.First().Tree.Sha) code give me only the files that are in the commit but I want also other files that exists at that level. How to do that?...

Repository.Stage(“*”) throws an ObjectDisposedException

I stage all files under the git repository for commit, commit the changes, then check for the changes and ammend the commit, changing its message. Take a look at my code: if (this.isRepoInit) // Check if the repository has been initialized successfully { using (Repository repo = repository) { //...

Binary files copied to a wrong folder on build

Recent libgit2sharp Nuget uses a new Nuget feature that allows you to include a piece of a build script in your NuGet. The purpose it to copy a native dll to a subfolder of the bin folder, like that: <ItemGroup> <None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-e0902fb.dll"> <Link>NativeBinaries\amd64\git2-e0902fb.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>... Now, it was all nice...

how to clone GitHub repo locally via libgit2sharp?

I wrote code to programmatically clone a GitHub private repo to a local repo via libgit2sharp ( v0.21.0.176 ) var cloneOptions = new CloneOptions { BranchName = "master", Checkout = true }; var cloneResult = Repository.Clone( @"", @"c:\github\my-organization\my-repo" ); exception thrown : {LibGit2Sharp.LibGit2SharpException: Request failed with status code: 401 at...

Setting upstream on a repo

I am trying to pull the master branch from a remote using libgit2sharp. Sometimes I have to change the remote to a different url and pull from that remote. When I change the remote and try to pull I get this error: There is no tracking information for the current...

LibGit2Sharp versioning error MSBuild

I'm getting the following error: Error 17 System.IO.FileLoadException: Could not load file or assembly 'LibGit2Sharp, Version=0.14.30212.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) File name: 'LibGit2Sharp, Version=0.14.30212.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.IO.FileLoadException: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) I...

Support of custom backends in libgit2sharp bindings

Does libgit2sharp support custom backend configuration (similar to

Changing the remote url of a repository in libgit2sharp

How can we change the remote url of a repository? using (var repository = new Repository(repositoryPath)) { //Change the remote url first //Then checkout } ...

LibGit2Sharp equivalent of git diff --stat

I'm looking for a way to capture how many lines have changed in each file in my working directory - like git diff --stat in git - is there a way to do this with LibGit2Sharp? I know I can get total LinesAdded/Deleted from a Patch, but I'm wondering on...

Sparse Checkout in LibGit2Sharp

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...