rubydiffwarningsgrit

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, helped me removing some of them and now I get the only the following:

UPDATE

changing hunk = hunk.map { |block| yield block } into hunk = hunk.map { |blk| yield block } both at lines 266 and 303 of diff-lcs (v1.1.2) removed this two warnings:

/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:266: warning: shadowing outer local variable - block
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:303: warning: shadowing outer local variable - block

UPDATE 2

As user @injekt says here process.rb will be removed in the next release. This will get rid of:

/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/grit-2.4.1/lib/grit/process.rb:289: warning: method redefined; discarding old spawn
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/grit-2.4.1/lib/grit/process.rb:221: warning: previous definition of spawn was here

UPDATE 3

THX to user @DogBert...

/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs/hunk.rb:69: warning: method redefined; discarding old flag_context=

...Disappeared by changing line 68 of hunk.rb, from :attr_accessor to :attr_reader inside the diff-lcs gem

Now I have a "stackoverflow meta" question: what I have to do with this question?


Solution

  • I managed to remove the warnings by:

    This GitHub diff, thx to @DogBert

    changed hunk = hunk.map { |block| yield block } into hunk = hunk.map { |blk| yield block } both at lines 266 and 303 of diff-lcs (v1.1.2)

    As user @injekt says here process.rb will be removed in the next release. This will get rid of this warnings:

    warning: method redefined; discarding old spawn
    warning: previous definition of spawn was here
    

    As user @DogBert said changing line 68 of hunk.rb, from :attr_accessor to :attr_reader inside the diff-lcs gem removed warning: method redefined; discarding old flag_context=...