Note that there are some explanatory texts on larger screens.

plurals
  1. PORuby-Git g.status always fails
    text
    copied!<p>I have been trying to use the ruby-git gem to make commits etc from with in a ruby script however the method to check the current status always throws an error. My understanding is that this code, although not doing too much, should be valid. </p> <pre><code>#gem install git require 'rubygems' require 'git' g = Git.init g.status </code></pre> <p>but it returns:</p> <blockquote> <p>Git::GitExecuteError: git diff-index "HEAD" 2>&amp;1:fatal: ambiguous argument 'HEAD': >unknown revision or path not in the working tree.<br> Use '--' to separate paths from revisions<br> from /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/lib.rb:700:in <code>command'<br> from /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/lib.rb:672:in</code>command_lines'<br> from /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/lib.rb:287:in <code>diff_index'<br> from /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/status.rb:99:in</code>construct_status'<br> from /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/status.rb:8:in <code>initialize'<br> from /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/base.rb:175:in</code>new'<br> from /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/base.rb:175:in `status'<br> from (irb):5 </p> </blockquote> <p>Does any one have examples of how to get the current git status within ruby (using ruby-git)?</p> <p>Pages I have looked at:<br> <a href="http://rubygems.org/gems/git" rel="nofollow noreferrer"><a href="http://rubygems.org/gems/git" rel="nofollow noreferrer">http://rubygems.org/gems/git</a></a><br> <a href="http://git.rubyforge.org/" rel="nofollow noreferrer"><a href="http://git.rubyforge.org/" rel="nofollow noreferrer">http://git.rubyforge.org/</a></a></p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload