Questions tagged [rugged]

Ruby open source bindings for libgit2, a native git library

Rugged is a library for accessing libgit2 in Ruby. It gives you the speed and portability of libgit2 with the beauty of the Ruby language.

Rugged gives you access to the many parts of a Git repository. You can read and write objects, walk a tree, access the staging area, and lots more.

Online resources

70 questions
1
vote
2 answers

How to lookup commit by tag/ref using the Rugged (libgit2) Ruby gem?

I'm using Rugged, the libgit2 binding for Ruby. I have seen that you can call the Repository#lookup method to get the object at a given SHA hash in a git repository. The thing is, I don't know the hash of the commit I'm looking for. I do know the…
Ben Wiley
  • 59
  • 7
1
vote
0 answers

How to get a git repository's default branch in Ruby's "rugged" gem?

Related to git - how to get default branch? I'm trying to port a Bash script to Ruby. The script uses git symbolic-ref --short HEAD to get a repo's default branch. Is there a way to combine rugged's repo.branches.each_name(:local) with some other…
Katrin Leinweber
  • 1,316
  • 13
  • 33
1
vote
1 answer

How do I apply a diff or patch file?

when using the rugged git library how can I apply that diff to my dest branch as a commit?. # @param src [Rugged::Object] - the rugged object or string to compare from # @param dst [Rugged::Object] - the rugged object or string to compare to,…
1
vote
1 answer

How do I use rugged to add and commit all files in a repository

I am initializing a git repository that already has some files in it repo = Rugged::Repository.init_at(".") I need to stage the files already in that folder and commit them. This is what I've tried: repo = Rugged::Repository.new(".") index =…
JeremyKirkham
  • 1,025
  • 2
  • 11
  • 22
1
vote
1 answer

Rugged: Path and commit_id of tree

I have a rugged tree object and I want to find out what is its path (relative to root) and what was the commit id when that tree was written. For example: tree = repo.lookup '7892eeee70c08fae4db63aef7000dea39f883b30' #sha/oid of tree What…
sonalkr132
  • 967
  • 1
  • 9
  • 25
1
vote
1 answer

Is the ɴᴜʟ character forbidden in filenames for Git repositories?

Without considering any implementation behaviour or host ᴏꜱ, are there by design, characters which aren't allowed in file or directory names? I’m especially interested (considering Git is sometimes used as front-end) if the ᴀꜱᴄɪɪ ɴᴜʟ character is…
user2284570
  • 2,891
  • 3
  • 26
  • 74
1
vote
1 answer

An error occurred while installing rugged

when I install the gitlab bundle install --deployment --without development test postgres puma aws i get the error: Fetching gem metadata from https://rubygems.org/........ Fetching version metadata from https://rubygems.org/... Fetching…
Jeremy
  • 21
  • 6
1
vote
2 answers

colorized diffs with Rugged?

I'm trying to colorize the output of a patch. Setting the color.diff config (via my .gitconfig) doesn't seem to do it. repo = Rugged::Repository.new('/some/path') repo.config = Rugged::Config.new("#{ENV['HOME']}/.gitconfig") log.info…
Nathan Meyer
  • 141
  • 5
1
vote
1 answer

Merging two branches in Rugged

Using Rugged, I create a new branch from master (let's call it new_branch), modify a file and create a commit for that. Now I want to merge this branch into master, push master to remote and delete new_branch. At the point of running the code below…
Khash
  • 2,500
  • 4
  • 30
  • 56
1
vote
0 answers

Rugged and Grack: Finding commit before push

I am using rugged for git related operations (initializing repo with web interface) and gitlab-grack for implementation of http-backend CGI. It is working fine and I am able to make push, pull etc. However, I want to find blobs which changed after…
sonalkr132
  • 967
  • 1
  • 9
  • 25
1
vote
1 answer

Find a branch of particular commit and checkout to it

How could I easily find a branch with a particular commit and checkout to it with rugged so that I won't end with 'detached HEAD' state? Step by step I'd like to: Clone repository repo.lookup commithash to return catch exception and exit if…
mieciu
  • 448
  • 3
  • 7
1
vote
1 answer

How to detect a file rename using Rugged?

I'm a novice Rugged user, and I'm attempting to detect file renames in the commit history. I'm diffing each commit against its first parent, as follows: repo = Rugged::Repository.discover("foo") walker =…
Ismael
  • 344
  • 1
  • 3
  • 14
1
vote
1 answer

Iterate with Ruby through git commits for a particular branch

I'd like to use Rugged to iterate through all the commits on a particular branch, from the oldest (first) to the newest (last). I'd like to examine the SHA1 and the comment for each. Maybe I'm better off just running 'git log --reverse' and parsing…
Ladlestein
  • 6,100
  • 2
  • 37
  • 49
1
vote
1 answer

Why am I seeing inaccurate diff deltas in libgit2 / rugged?

When using rugged to remove files to stage a commit, the diff for the commit comes out with false information about which files were deleted. The files that are supposed to be there are still actually there and the resulting state of the project is…
davetakahashi
  • 494
  • 1
  • 4
  • 12
1
vote
1 answer

Is there a specific protocol to add everything to Git using Rugged?

I recently began using Rugged, and have already run into some problems. Basically all I want to do is add everything in a Git repo, commit the staged changes, and push everything to a branch. I've started out with the first step as follows: @repo =…
T145
  • 1,415
  • 1
  • 13
  • 33