FAQ Database Discussion Community


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

git,libgit2sharp
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...

how to clone GitHub repo locally via libgit2sharp?

git,github,git-clone,libgit2sharp,repo
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( @"https://github.com/my-organization/my-repo.git", @"c:\github\my-organization\my-repo" ); exception thrown : {LibGit2Sharp.LibGit2SharpException: Request failed with status code: 401 at...

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

git,f#,libgit2sharp
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])...

LibGit2Sharp get repository changes after pull

c#,git,git-commit,pull,libgit2sharp
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...

Support of custom backends in libgit2sharp bindings

libgit2sharp
Does libgit2sharp support custom backend configuration (similar to https://github.com/libgit2/libgit2-backends)?

Repository.Stage(“*”) throws an ObjectDisposedException

c#,git,libgit2sharp
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) { //...

LibGit2Sharp versioning error MSBuild

tfs,msbuild,tfsbuild,libgit2sharp
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...

Binary files copied to a wrong folder on build

msbuild,appharbor,post-build-event,libgit2sharp
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...

Changing the remote url of a repository in libgit2sharp

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

Read the files at the spesific commit with libgit2sharp

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

Setting upstream on a repo

git,libgit2,libgit2sharp
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...

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

c#,git,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 equivalent of git diff --stat

libgit2,libgit2sharp
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

git,bash,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...

Searching file in branch

git,libgit2,libgit2sharp
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...