libgit2sharp

Work with libgit2sharp to retrieve only the latest revision of a specific branch

不想你离开。 提交于 2019-12-02 02:49:30
Consider the following scenario: Some content (e.g. a web-site) is under git repository having several branches like master (for dev), qa and prod. A .net application (e.g. some cloud service) needs to have always the latest version of one specific branch (e.g. prod). There is no need to fetch full repository, only HEAD of this branch (git clone -b <branch> --depth=1 <remote_repo_url> --single-branch) and perform consequent updates. How would you implement such scenario with libgit2sharp library? Cloning only a truncated portion of the history from a repository (ie. shallow cloning) is not

libgit2sharp remove remote branch

空扰寡人 提交于 2019-12-01 23:31:24
问题 I want to delete a branch locally and remote. My code: using (var repository = new Repository(path)) { var remote = repository.Network.Remotes["origin"]; var options = new PushOptions(); var credentials = options.CredentialsProvider = GetUserCredentialsProvider(); options.CredentialsProvider = credentials; string pushRefSpec = @"refs/heads/:{0}".FormatWith(branch); repository.Network.Push(remote, pushRefSpec); repository.Branches.Remove(repository.Branches[branch]); } But I get the 401 error

libgit2sharp remove remote branch

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 21:55:55
I want to delete a branch locally and remote. My code: using (var repository = new Repository(path)) { var remote = repository.Network.Remotes["origin"]; var options = new PushOptions(); var credentials = options.CredentialsProvider = GetUserCredentialsProvider(); options.CredentialsProvider = credentials; string pushRefSpec = @"refs/heads/:{0}".FormatWith(branch); repository.Network.Push(remote, pushRefSpec); repository.Branches.Remove(repository.Branches[branch]); } But I get the 401 error ("Unauthorized"). And it's because of the presence of the ":" in the name of the branch. But I read

Unable to load DLL 'git2.dll' The specified module could not be found

大兔子大兔子 提交于 2019-12-01 21:18:17
问题 I'm trying to use libgit2sharp in a web-project. The problem is that libgit2sharp's solution is for VS2010 and I'm using VS2008. So I had to create a new solution and modify the code not to use default parameters. That wasn't a problem, except I'm getting the exception listed in the title when I try to use the compiled libgit2sharp DLL. I've tried linking in the git2.dll, but that hasn't helped. Copying the git2.dll into the web-project hasn't helped either. Edit : The issue was handled over

Unable to load DLL 'git2.dll' The specified module could not be found

可紊 提交于 2019-12-01 19:44:15
I'm trying to use libgit2sharp in a web-project. The problem is that libgit2sharp's solution is for VS2010 and I'm using VS2008. So I had to create a new solution and modify the code not to use default parameters. That wasn't a problem, except I'm getting the exception listed in the title when I try to use the compiled libgit2sharp DLL. I've tried linking in the git2.dll, but that hasn't helped. Copying the git2.dll into the web-project hasn't helped either. Edit : The issue was handled over at the LibGit2Sharp issue tracker: https://github.com/libgit2/libgit2sharp/issues/39 Off the top of my

How to find all commits having a particular parent?

与世无争的帅哥 提交于 2019-12-01 07:02:05
How may I find all commits in a repository that have a specific parent? For example, if I have a commit A , I would like to find all other commits that share the parent with A . What would be the most effective, i.e. performant yet correct way to do this in LibGit2Sharp? That's a tricky question ;-) The Git object allows to retrieve the parents of a commit. However, there's no easy way to find the children of a commit. The following code would however partially solve this. The idea is to perform a git log from all the references of the repository (heads, tags, ...) and, along the way, select

How to find all commits having a particular parent?

五迷三道 提交于 2019-12-01 05:54:35
问题 How may I find all commits in a repository that have a specific parent? For example, if I have a commit A , I would like to find all other commits that share the parent with A . What would be the most effective, i.e. performant yet correct way to do this in LibGit2Sharp? 回答1: That's a tricky question ;-) The Git object allows to retrieve the parents of a commit. However, there's no easy way to find the children of a commit. The following code would however partially solve this. The idea is to

Best way to do parallel stages?

為{幸葍}努か 提交于 2019-11-30 18:24:38
问题 I want to stage files in parallel and commit into different branches concurrently. There will be multiple access at the same time. The repo.Index.Stage/repo.Commit API works on the same current directory so I think this is out of the question. Can you guys give me some tips on how this might be achievable? A general idea? 回答1: From a feasibility perspective, I can think of two different options: Considering the "stage files in parallel" as a constraint The word "staging" in git parlance

How to retrieve the history of a file?

假如想象 提交于 2019-11-30 10:59:47
I got another libgit2 issue and will be very grateful for your help. I'm trying to retrieve file history, i.e. list of commits where this file was changed. And it seems to be quite unconventional... As far as I can see, there are no function for that. The only approach I can come up with is to use revision walking API to iterate through revisions, check the tree object attached to commit and search for given file there, if found, add commit to my list, otherwise proceed to next commit. But it looks none-optimal for me... May be is there any other approach, for example, look directly into .git

costura.fody for a dll that references another dll

蹲街弑〆低调 提交于 2019-11-30 05:14:48
问题 I have a small exe I've written that uses LibGit2Sharp and am trying to use Costura.Fody to embed everything so I only have a single exe to distribute (actually, there are two config files as well, but that's ok). The problem seems to be that LibGet2Sharp.dll has a fairly firm reference to git2-1196807.dll , and I can't seem to figure out how to embed the latter in the way the former can use. I've tried several things, but I think my best attempt is: all of these .dll's are copied from the