libgit2

How to detect what commit a branch has been created from in LibGit2Sharp

拜拜、爱过 提交于 2019-12-12 15:26:53
问题 So given an instance of LibGit2Sharp Branch how do you work out what commit that it was initially created from? 回答1: A Branch is merely an object depicting a git head reference. A head is a text file, mostly living under the .git/refs/heads hierarchy. This text file contains the hash of the commit this head currently points to. Similarly, a Branch bears a Tip property which points to a Commit . When working with git repositories and performing actions such as committing, resetting, rebasing..

Download one file from remote (git show) using libgit2sharp

本小妞迷上赌 提交于 2019-12-12 10:44:11
问题 Using git show , I can fetch the contents of a particular file from a particular commit, without changing the state of my local clone : $ git show <file> $ git show <commit>:<file> How can I achieve this programatically using libgit2sharp? 回答1: According to the documentation: $ git show 807736c691865a8f03c6f433d90db16d2ac7a005:a.txt Is equivalent to the code below: using System; using System.IO; using System.Linq; using System.Text; using LibGit2Sharp; namespace ConsoleApp2 { class Program {

Getting Rugged::NetworkError on #connect

我与影子孤独终老i 提交于 2019-12-12 07:29:18
问题 I tried to implement fetch and this exception was raised: Rugged::NetworkError: This transport isn't implemented. Sorry I am able to retrieve a remote instance: remote = Rugged::Remote.lookup(repo, remote_name) remote.connect(:fetch) # => Rugged::NetworkError: This transport isn't implemented. Sorry I retrieved the development version of the gem as directed in the README: gem 'rugged', git: 'git://github.com/libgit2/rugged.git', branch: 'development', submodules: true How do I gain access to

setting credentials just for the first time (libgit2)

我们两清 提交于 2019-12-12 04:31:38
问题 So I use some libgit2 functions to connect to the remote and perform git push. I want to push to private repository, so I have to set credentials. But for example, when I work with private repositories via git commands and I want to connect for the first time to this repository, I enter credentials...but after that, if I want to push for the second, third time or so, I don't have to write that credentials again, also when I restart computer. It seems to me that there is some place where

Is there a way to list all repositories in a Git Organization using Libgit2sharp?

旧巷老猫 提交于 2019-12-12 03:36:27
问题 Is there a way to list all repositories in a Git Organization using Libgit2sharp? I did check here https://github.com/libgit2/libgit2sharp/wiki. But seems like there are no wiki pages explaining "working with Git Organization"! 回答1: Libgit2sharp is a C# library for git. Git Organizations however are a GitHub construct and will be available only via the Github API. So the solution would be to write your own code to that integrates Libgit2sharp and the GitHub API 来源: https://stackoverflow.com

How can I skip SSL verification using libgit2sharp?

旧巷老猫 提交于 2019-12-12 03:23:26
问题 I am new to libgit2sharp (and git in general). I am trying to write a small program that handles multiple repositories in an unified manner. However, I've hit a brick wall when trying to deactivate the SSL verification. The library doesn't seem to provide an easy way to do this. I've found a branch (which seems to deal with the problem) and copied some code from there My current code looks like this (I've deleted personal stuff"): static void Main(string[] args) { //Additional code

Un-stage file with libgit2

最后都变了- 提交于 2019-12-11 21:25:37
问题 Using objective-git and libgit2 it has been fairly easy to stage a file ready for commit: GTIndex *repoIndex = [self.repository indexWithError:&error]; [repoIndex removeFile:path error:&error]; if (status != GTFileStatusIgnored && status != GTFileStatusWorkingDeleted) { // Now add the file to the index [repoIndex addFile:path error:&error]; } [repoIndex write:&error]; However un-staging a file is proving to be a tad more tricky. Simply removing it from the repository's index doesn't work as

LibGit2Sharp fails to find git2.dll

最后都变了- 提交于 2019-12-11 15:33:56
问题 I have built a tiny wpf app that manages a website I am working on. The key feature of this app is that it allows me to checkout different branches of a theme repository. This works perfectly in visual studio, but when I publish, install and run the app on my windows 8 machine it comes back with: {"Unable to load DLL 'git2': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"} I have searched through the internet and stackoverflow. There are similar questions, such

In libgit2, what do the git_index_entry->flags_extended mean (and when are they set)?

筅森魡賤 提交于 2019-12-11 12:36:42
问题 I am attempting to manage a repository's index vs. its HEAD tree using libgit2 (via Objective-Git, but I'm increasingly finding myself heading down the vanilla libgit2 rabbit hole), and am wondering what exactly the flags_extended field's bitmasks on git_index_entry struct actually mean. Additionally, when are these flags set? I've been digging through the libgit2 source, but cannot seem to find where flags_extended comes into play. The reason I ask: I have a simple test repository with one

How can I check if pull is needed using libgit2 in c++? [closed]

China☆狼群 提交于 2019-12-11 09:29:48
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I want to check if I have the latest version of program. I have my program shared to bitbucket.org , and I want my c++ code to write me if I need to pull the latest version, or I already have the latest version. 回答1: First, you have to fetch to get the state of the remote tracking