get latest commit for blob with ruby/grit
i cloned a copy of the git-wiki for some educational programming. now, as a challange, i tried to figure out how to get the date for the blob.
the blob is fetched with
repository.tree/(page_name + extension)
as far as i saw it, you can only get a date for a commit. but how to get 开发者_如何学Cthe latest commit containing the blob?
You can do it like this.
repository.log("master", "app/models/....", :max_count => 5, :skip => 1)
then you'll get commits related to the blob. The first param is a branch name and the second is the path of the blod. :max_count
and :skip
are optional parameters. Take a look at grit's rubyforge for more functionality. This question is also helpful.
精彩评论