I'm trying to create a comma with a ruby script to use ruby-git gem, though the method To check the current situation always throws an error. My understanding is that this code, although not doing too much, should be valid.
#gem install git 'rubygems' is required 'git' g = Git.init g.status but it returns:
Git :: GitExecuteError: git diff-index "HEAD" 2> and 1: Fatal: Unclear logic 'HEAD':> Unknown modification or path is not in the work tree.
'-' To separate routes from modifications - / Users / X / Been / RBI-ee-1.8.7 / lib / ruby / gems / 1.8 / gems / git-1.2.5 / lib / git / From lib.rb: 700 tocommand / / to user / x / bin / ruby-ee-1.8.7 / lib / ruby / gems / 1.8 / gems / git-1.2.5 / lib / git / lib In .rb: 672: fromcommand_lines' / users / x / bin / ruby-ee-1.8.7 / lib / ruby / gems / 1.8 / gems / git-1.2.5 / lib / git / lib. From rb: 287: todiff_index '
to /Users/X/bin/ruby-ee-1.8.7/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/ Status from RB: 99: in / usr / users / x / bin / ruby / ee-1.8.7 / lib / ruby / gems / 1.8 / gems / git-1.2.5 / lib / git / from status_status .rb: 8: In theGetting Started / From User / X / bin / ruby-ee-1.8.7 / lib / ruby / gems / 1.8 / gems / git-1.2.5 / lib / git /base.rb:175:inn Eve ' Users / X / Bin / Ruby-ee-1.8.7 / Lib / Ruby / Games / 1.8 / gems / git-1.2.5 / lib / git / base.rb: 175: In In 'From (IRB): 5 From (IRB): 5
Does anyone have an example of how the current GIT status can be obtained within Ruby (Ruby-GIT)?
Pages I have seen:
thanks
The path may be a significant bit of error message
unknown modification or path in the work tree I have tried to run:
$ irb> Requires 'RubyGums' & gt; 'Git' & gt; G = Git.init & gt; G.status There is no GIT repo in a directory, and it was blown up like you.
After this cd directory root of a project with GIT repo works, it works.
Check that you are in the root of GIT repo should have a .git directory. If not, you can also pass the path of Git.init if cd is inconvenient for any reason.
Comments
Post a Comment