Questions tagged [git2-rs]
15 questions
1
vote
1 answer
How to use git2::Remote::push correctly?
I'm building an app which internally uses git2.rs to manage a project.
I'm trying to implement tests for basic use cases such as git init, git add, commit and push to a remote and I have problems with the pushing part.
I implemented my test case…

Peterrabbit
- 2,166
- 1
- 3
- 19
1
vote
0 answers
Signed Commit in git2-rs not appearing in repo
I'm trying to used signed commits with git2 in rust if there is a signkey in the gitconfig, I have found that using a regular commit, everything works fine and automatically is picked up however when i use commit_signed it doesn't show up in the…

dev
- 95
- 2
- 12
1
vote
1 answer
Skip commit if no files are changed in git2/libgit2
I'm using the git2 crate which wraps libgit2.
I'm adding files to the index whether or not they are changed to stage them for committing.
If there are no files changed in the repo, when I commit, I get an empty commit, that I'd like to avoid. I…

Daniel A. White
- 187,200
- 47
- 362
- 445
0
votes
0 answers
SSL certificate invalid when attempting to clone repository using git2 on Android
I'm encountering an issue while trying to clone a repository using the git2 library on Android. Initially, I had trouble compiling OpenSSL for Android using Rust. However, I managed to successfully compile it by adding the following dependency to my…

PP Kun
- 11
- 4
0
votes
1 answer
Does Rust git2 library support cloning repositories into memory?
I want to clone the github repository into my memory
But I don't seem to find any function that supports cloning to memory
Is this possible with mempack or odb
I tried to use odb or mempack to implement cloning to memory
I asked ChatGPT, but the…

PP Kun
- 11
- 4
0
votes
0 answers
Issue with git2r and R: "config value 'http.followRedirects' was not found"
I'm trying to use git2r package in R to commit and push a file to my repository.
The code I'm using is like that:
# Clone existing github repo using url and linking this to your project path
clone(url = "https://github.com/path/repository",…
0
votes
0 answers
Blame a blob on a specific branch in rust git2
In git git blame master -- can be used to blame a file on a specific branch but i cannot seem to find a way to replicate this functionality in rust git2. If anyone knows how this can be done then please tell me.

Snek
- 141
- 1
- 7
0
votes
0 answers
Extracting objects form packfiles with git2
I would like to parse a packfile's objects to the git2 types such as git2::Commit, Blob, Tree etc...(The pacfile is a String)
Is there something in the git2 crate for this, i've looked for some time but i am unable to find anything that i could use…

Snek
- 141
- 1
- 7
0
votes
0 answers
How to do "git add ." for a bare repo (git init -- bare) in rust with git2 or other way?
I am trying to create a bare git repo, git clone into another directory, and do the git add . & git commit & git push. However, I could not successfully complete git add . After I did git add ., I checked by git status , the target file hasn't been…

yog sothoth
- 13
- 2
0
votes
1 answer
Return owned item and reference to item
I am using the git2 crate and would like to get Statuses for the repo and store this in my app struct for reuse later since it is expensive to create. The problem is that Statuses references the Repository from which it was created. As far as I…

Max888
- 3,089
- 24
- 55
0
votes
1 answer
Programmatically create a diff patch using git2
I want a function that accepts two strings and generates a diff patch string, a la git diff foo.
I am working on a wiki-style system with history. To implement history, I thought it would be effective to store document patch contents only, rather…

cdaringe
- 1,274
- 2
- 15
- 33
0
votes
1 answer
git2 restore staged file
I am trying to build a hobby app to provide a UI for Git. I am trying to perform the equivalent of git restore --staged . The below seems to successfully perform the correct action in the case where the file is newly added to the index, so I…

Max888
- 3,089
- 24
- 55
0
votes
1 answer
git-rs leaving index in odd state
I'm using libgit2 via git-rs. I'm trying to commit things which is working, however, old files are showing up as deleted and/or staged even after the commit. How can I clean this up?
let repo: Repository = ...
let head_commit = match repo.head() {
…

Daniel A. White
- 187,200
- 47
- 362
- 445
-1
votes
1 answer
How to build openssl-sys for android?
I wrote a program that uses the git2 library and it compiled fine on my local machine (Macbook M2,openssl installed using brew), but when I tried to compile the program for Android, it gave me an "error: failed to run custom build command for…

PP Kun
- 11
- 4
-1
votes
1 answer
How to clone repository from branch using git2-rs?
recently I wanted to copy files from a repo, in rust using Repository::clone, but this function does not support branches. I wanted to ask how to copy files from a branch.
I am currently using git2 version 0.17.1, and rust version 1.69.0 (84c898d65…

malezjaa
- 7
- 2