我正在学习grit(2.4.1版)。这是我的基本代码:

#!/usr/bin/env ruby -wKU

require "grit"
repo = Grit::Repo.new("./myproject")

p repo.commits

运行这个代码给了我很多警告。This GitHub diff,正如用户@dogbert指出的,帮助我删除了其中的一些,现在我只得到以下信息:
更新
diff-lcs(v1.1.2)第266行和第303行的hunk = hunk.map { |block| yield block }更改为hunk = hunk.map { |blk| yield block },删除了这两个警告:
/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

更新2
正如用户@injekt所说,process.rb将在下一个版本中被删除。这将消除:
/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

更新3
发送给用户@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=

…通过将hunk.rb的第68行从diff lcs gem中的:attr_accessor更改为:attr_reader而消失
现在我有一个“stackoverflow meta”问题:
我和这个问题有什么关系?

最佳答案

我设法消除了警告:
This GitHub diff,thx至@dogbert
在差异LCS(v1.1.2)的第266和303行将hunk = hunk.map { |block| yield block }更改为hunk = hunk.map { |blk| yield block }
正如用户@injekt所说,process.rb将在下一个版本中删除。这将消除以下警告:

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

正如用户@dogbert所说,将hunk.rb的第68行从diff lcs gem中的:attr_accessor改为:attr_reader删除了warning: method redefined; discarding old flag_context=...

10-04 21:40