admin管理员组文章数量:1336568
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?
本文标签: rubyGet a file39s commit history with RuggedStack Overflow
版权声明:本文标题:ruby - Get a file's commit history with Rugged - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742403438a2468341.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论