Questions tagged [grit]

A rubygem that allows OO access to git repositories.

grit in it's own words:

Grit gives you object oriented read/write access to Git repositories via Ruby. The main goals are stability and performance. To this end, some of the interactions with Git repositories are done by shelling out to the system's git command, and other interactions are done with pure Ruby reimplementations of core Git functionality. This choice, however, is transparent to end users, and you need not know which method is being used.

Certain parts of grit rely on the git binary, others are implemented in pure ruby. The distinction between the two is contained here.

35 questions
7
votes
1 answer

How does Github allow for inline file editing? (Or how to add or edit files in a bare git repository)

I have a small application that manages several git repositories similar to Github/Gitorious. Github allows for inline file editing, and I'd like to know if anyone has any idea on how they manage this. My initial thought was that it would do a…
Jonathan C.
  • 227
  • 2
  • 5
7
votes
2 answers

Example of a git push using either rugged or grit

I'm looking for some code examples, for either rugged or grit, showing how to do a git push. Background I have rake tasks deploy:staging and deploy:production that I use to deploy my app. I'm deploying to heroku, so these tasks essentially do the…
Scott
  • 1,518
  • 1
  • 15
  • 23
7
votes
5 answers

How to detect conflict between two git repositories.

To implement github like fork/pull request function in my project, the auto-merge feature need to detect conflict between source/target repository every time while viewing the pull request. One solution comes to me is to analyze the 'git…
stcatz
  • 341
  • 1
  • 3
  • 8
5
votes
1 answer

Grit's clone method is undefined?

I've recently started working on a project that uses git for storage and ruby as a front-end. The first version of my script used ruby-git, which was ok though pretty simple. When I needed to do more specific work with my commits and logs it was…
Z99
  • 73
  • 7
5
votes
1 answer

Is it possible to use the gift library to view all of the branches of a remote repository?

Gift is a node.js library that implements grit like functionality. To view remote branches, ordinarly I would do git branch -r, but I don't see any such functionality in the gift package. Is it possible, using gift, to view all of the remote…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
4
votes
1 answer

Can I get the progress of a git clone command, issued in grit, output to stdout?

I'm fairly confident this is either not possible or I'm missing an obvious option, but after consulting grit's Git class, the gist linked in this SO post, and the other grit tagged questions on SO, I'm coming up blank. I'm using grit for a series of…
Christopher
  • 42,720
  • 11
  • 81
  • 99
4
votes
3 answers

Is it possible to add/commit a file to the index of a local bare Git repo?

I'm messing around with the Ruby Git gem... seeing how I can use it to manage/access a Gitosis server I'm running. Does anyone know if it is possible to add/commit files to a local bare repo, or will I need to set up a local 'normal' repo and use…
Bryan
  • 2,205
  • 1
  • 23
  • 43
4
votes
1 answer

Git: Editing a file in a bare repo using Git plumbing commands

I'm trying to create a basic GIT web UI for GIT bare repos which allows edit (only) of existing files. For example, considering these two cases: /dir-a/dir-b/dir-c/a-file.txt /a-file.txt How could I use the Git low level plumbing commands to save…
Akshay Rawat
  • 4,714
  • 5
  • 40
  • 65
3
votes
1 answer

Grit warnings on ruby 1.9

I'm learning grit (version 2.4.1). Here is my basic code: #!/usr/bin/env ruby -wKU require "grit" repo = Grit::Repo.new("./myproject") p repo.commits Running this code gave me a lot of warnings. This GitHub diff, as pointed out by user @Dogbert,…
microspino
  • 7,693
  • 3
  • 48
  • 49
3
votes
1 answer

Download and modify file from Git Repository using Ruby Grit over SSH

How can I download a file (or clone the repo) from a secure Git Repo (e.g. SSH on GitHub), then commit changes back to the repo using Ruby Grit? Thanks!
Jacob Foshee
  • 2,704
  • 2
  • 29
  • 48
2
votes
2 answers

Creating tags with Grit

I'm trying to create a tag in my git repository via Grit, but I'm not sure that the library supports referenced tags. It's easy to create a tag like this: Grit::Tag.create_tag_object(repo, params, actor) But that will only create a lightweight tag.…
Ronze
  • 1,544
  • 2
  • 18
  • 33
2
votes
2 answers

Does Grit works with Windows 7 well?

I have tried the last day to work with the Ruby gem git (version 1.2.5), but I am not sure that it works well enough. I stumbled over grit, which is more active, but was not able to get it working under Windows 7. Do you have used grit under Windows…
mliebelt
  • 15,345
  • 7
  • 55
  • 92
2
votes
3 answers

A few questions about Grit

I have a few questions about Grit/Git that I hope you can help me with. Here's my code: # create Repo r = Repo.init_bare 'myrepo.git' i = r.index # first commit to master i.add('myfile.txt', 'my file contents') i.commit("This is my commit") #…
Ronze
  • 1,544
  • 2
  • 18
  • 33
1
vote
1 answer

Getting blobs with Grit

I'm using Grit in my rails app and I'm creating a commit which i know works: repo = Repo.new(full_path, {:is_bare => true}) fname = "snippet" File.open("#{full_path}/#{fname}", 'w') {|f| f.puts(data)} …
LuxuryMode
  • 33,401
  • 34
  • 117
  • 188
1
vote
2 answers

How to get the last commit date of a file with ruby/grit?

I have a jekyll site, and I want to find the last commit date of a certain post using ruby/grit. I know that I can do the following using git: git log -1 --format="%cd" -- How can I do something equivalent using ruby/grit please?
Robert Audi
  • 8,019
  • 9
  • 45
  • 67
1
2 3