libgit2sharp

What's the fastest way to find Tags pointing to Commits?

喜你入骨 提交于 2019-11-30 04:48:21
问题 With libgit2sharp I would like to do the following: foreach( Commit commit in repo.Commits ) { // How to implement assignedTags? foreach( Tag tag in commit.assignedTags ) {} } I want to get all tags assigned to the current commit. Whats the best way to do that? Iterate through all Tags and see if tag.Target.Sha == commit.Sha ? Thats not very performant. Is there another way? 回答1: So I want to get all tags assigned to the current commit. Whats the best way to do that? Iterate through all Tags

How to retrieve the history of a file?

自古美人都是妖i 提交于 2019-11-30 01:10:05
问题 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

How to use libgit2sharp with ssh-transport-protocol?

一世执手 提交于 2019-11-29 07:02:28
When I use libgit2sharp in project to clone repository with ssh-transport protocol, like git@github.com:libgit2/libgit2sharp.git It throw an exception, says "This transport isn't implemented. Sorry" How can I clone repository with ssh-transport-protocol by using libgit2sharp ? Unfortunately, Ssh protocol is not supported yet. At this time only git:// (read-only) and http[s]:// protocols are. However, it will eventually be, by leveraging the libssh2 library. Subscribing to issue #255 notifications will keep you updated about the progress made regarding this feature. Update: There's a work in

LibGit2Sharp: Fetching fails with “Too many redirects or authentication replays”

不羁岁月 提交于 2019-11-28 13:01:38
Here's the code I'm using to fetch: public static void GitFetch() { var creds = new UsernamePasswordCredentials() {Username = "user", Password = "pass"}; var fetchOpts = new FetchOptions {Credentials = creds}; using (repo = new Repository(@"C:\project");) { repo.Network.Fetch(repo.Network.Remotes["origin"], fetchOpts); } } but it fails during fetch with the following exception: LibGit2Sharp.LibGit2SharpException: Too many redirects or authentication replays Result StackTrace: at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) at LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteSafeHandle

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

纵饮孤独 提交于 2019-11-28 09:57:58
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 + "/" + treeEntry.Path; arquivos.Add(caminho); } } return; } I did a look on this question , but I'm newbie with C# and don't understand. I have this repository: c:/teste | - octocat.txt | - parentoctocat.txt | - /outros | | - octocatblue.txt | | - octored.txt My last commit

How to use libgit2sharp with ssh-transport-protocol?

断了今生、忘了曾经 提交于 2019-11-28 00:17:30
问题 When I use libgit2sharp in project to clone repository with ssh-transport protocol, like git@github.com:libgit2/libgit2sharp.git It throw an exception, says "This transport isn't implemented. Sorry" How can I clone repository with ssh-transport-protocol by using libgit2sharp ? 回答1: Unfortunately, Ssh protocol is not supported yet. At this time only git:// (read-only) and http[s]:// protocols are. However, it will eventually be, by leveraging the libssh2 library. Subscribing to issue #255

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

柔情痞子 提交于 2019-11-27 03:24:51
问题 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 + "/" + treeEntry.Path; arquivos.Add(caminho); } } return; } I did a look on this question, but I'm newbie with C# and don't understand. I have this repository: c:/teste | -