gitlabhq / grit

Grit gives you object oriented read/write access to Git repositories via Ruby. Patched for GitLab
gitlab.org
MIT License
59 stars 55 forks source link

Get blob path (eg. @blob.path = 'lib/grit/blob.rb') #24

Open ryosuzuki opened 11 years ago

ryosuzuki commented 11 years ago

I add instance method to get path of blob and tree (and also add method to get repo)

Usage

Blob

You can get current blob path with @blob.path ( default is master branch)

repo = Grit::Repo.new(".")
@blob = repo.tree/"lib/grit/blob.rb"
@blob.path
#=> "lib/grit/blob.rb"

And you can also set specific commit like this

repo = Grit::Repo.new(".")
commit = repo.commits.first
@blob = commit.tree/"lib/grit/blob.rb"
@blob.path(commit) 
#=> "lib/grit/blob.rb"
coveralls commented 11 years ago

Coverage Status

Coverage remained the same when pulling 27f947fd660c7b64a262323c1588c38ecb2d2d61 on mitakalab:blob into 16e7586acc48691cd016447295bce62e524cce65 on gitlabhq:master.