libgit2

How to push (with libgit2)

瘦欲@ 提交于 2019-12-05 06:09:05
How do I do a push with libgit2? (Like git push origin master on console) I want to use the C version. Cloning, opening, adding files to index and committing work like a charm (see code ). The test-bare-repository is local. Unfortunately, reference and documentation did not help me. Examples are very rare and mostly outdated ( like this , the git_push_new() function seems to be gone). I'm guessing for some hours now and I think I tried all meaningfull combinations of code snippets from reference and examples . Edit: I fear there is no possibility to do that with libgit2 at all. Can anyone

Get changes between a commit and its parent with libgit2sharp

♀尐吖头ヾ 提交于 2019-12-04 20:26:08
问题 I am working with libgit2sharp (a C# wrapper for libgit2) and have been running into issues because it doesnt have a lot of the functionality I am hoping for (hopefully I can contribute to it soon; this seems like a really useful project) The thing I am trying to do right now is get a list of the files changed from a particular commit and its parent. I will not try to figure out what has changed between a merge and its two parents. I am more interested in regular commits. These guys (https:/

How to commit to a git repository using libgit2?

守給你的承諾、 提交于 2019-12-04 19:13:10
Since there is no copy-paste example for creating a commit without using files on disk with libgit2 as far as I can tell I thought I should add one. Don't forget that libgit2 is in full development at this time (March 2013) so have a look at official documentation and source code, as new features are added daily: libgit2 API headers are very well commented - here's an example extensive tests may be a source of inspiration there are some official examples , general.c is a good place to start inspiration may be found in LibGit2Sharp - here are some tests bool addGitCommit ( git_repository * repo

how can i use rugged to create and commit a file like from the command line?

两盒软妹~` 提交于 2019-12-04 18:04:41
i'm trying to use rugged to do something pretty simple: create and commit a file, leaving the repository in the same state as doing: git init echo "blah blah blah" > blah.txt git add blah.txt git commit -m "write blah.txt" which leaves git status printing On branch master nothing to commit, working directory clean i'm using code adapted from the rugged repo's readme , which boils down to: name = "blah.txt" repo = Rugged::Repository.init_at dir File.open File.join(dir, name), 'w' do |f| f.write content end oid = Rugged::Blob.from_workdir repo, name index = repo.index index.add(:path => name,

libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found error in TortoiseGit

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 01:35:52
I got this error when starting up TortoiseGit: Could not get all refs. libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found While annoying, it does not prevent me from using TortoiseGit. However, I'd like to make it go away, because it is, well, annoying . How do I fix this? Updated Answer So it turns out that, for the purpose of updating a local repo's view of which branch <remote>/HEAD points to, you can have git automatically fetch that information from the remote and set it locally for you, instead of having to manually set it with git symbolic-ref like in my old solution above:

Get changes between a commit and its parent with libgit2sharp

試著忘記壹切 提交于 2019-12-03 12:47:21
I am working with libgit2sharp (a C# wrapper for libgit2) and have been running into issues because it doesnt have a lot of the functionality I am hoping for (hopefully I can contribute to it soon; this seems like a really useful project) The thing I am trying to do right now is get a list of the files changed from a particular commit and its parent. I will not try to figure out what has changed between a merge and its two parents. I am more interested in regular commits. These guys (https://github.com/libgit2/libgit2sharp/issues/89) are working on something similar. I think their procedure is

Git repository internal format explained

女生的网名这么多〃 提交于 2019-12-03 09:08:59
问题 Is there any documentation on how Git stores files in his repository? I'm try to search over the Internet, but no usable results. Maybe I'm using incorrect query or maybe this is great secret — Git repository internal format? Let me explain, why I need this rocket science information: I'm using C# to get file history form repository. But in libgit2sharp library it's not implemented currently. So (as a responsible person ;) I need to implement this feature by myself and contribute to community

How to retrieve all object IDs?

拥有回忆 提交于 2019-12-03 07:15:12
I am trying to get a list of all object IDs in a git repository, using libgit2. I can't seem to find any method for this. Does libgit2 have a method to get all object IDs (or iterate through them), or do I need to read them manually? What you may be looking for is the revision walking API. Description of the feature can be found here . A test demonstrating different walking strategies may also provide you with some help Edit: A thread in the libgit2 mailing list specifically deals with this. A more precise answer from Vicent Marti (libgit2 maintainer) is ... Just push every single HEAD into

LibGit2 clone repo using ssh: Invalid version 0 on git_clone_options

情到浓时终转凉″ 提交于 2019-12-02 20:29:32
问题 I apologize in advance because I'm extremely new to libgit2/git. I was trying to clone a git repository using ssh, and I'm getting an error below: Error code: -1 Invalid version 0 on git_clone_options I replaced some paths with arbitrary variables for privacy. I just believe I'm doing the steps improperly. cred_acquire_cb(git_cred** cred, const char* url, const char* username_from_url, unsigned int allowed_types, void* payload) { return git_cred_ssh_key_new(cred, "git", URL, pathToPublicKey,

libgit2 how to get the the status of the current directory?

旧巷老猫 提交于 2019-12-02 16:45:03
问题 How can I get the status of a single directory, rather than the whole repository? I have looked at the following: git_status_list_new which gets the repository status, but I care only about files located in a single directory. git_status_file which gets the status of a single. Is there a way that I can get the status of a single directory using libgit2? 回答1: git_status_list_new accepts a git_status_options struct, which contains a pathspec member which controls which files will be included in