ruby - Get a file's commit history with Rugged - Stack Overflow

I would like to use Rugged to get the commit history of a file, similar to what git log <filename>

I would like to use Rugged to get the commit history of a file, similar to what git log <filename> produces. But I can't seem to find a direct way to do this in the Rugged API. Perhaps I am overlooking it?

The best way I have found of doing it is by using a Rugged Walker:

walker = Rugged::Walker.new(repository)
walker.push(repository.head.target.oid)
history = []
walker.each do |commit|
  commit.diff.each_delta do |delta|
    history.push(some_commit_info) if delta.new_file[:path] == file_path
  end
end

Is there a more direct way of achieving this, rather than by taking this low level approach?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742403439a4437368.html

相关推荐

  • ruby - Get a file&#39;s commit history with Rugged - Stack Overflow

    I would like to use Rugged to get the commit history of a file, similar to what git log <filename>

    10小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信