grit icon indicating copy to clipboard operation
grit copied to clipboard

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

Open ryosuzuki opened this issue 11 years ago • 1 comments

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"

ryosuzuki avatar Jun 01 '13 14:06 ryosuzuki

Coverage Status

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

coveralls avatar Jun 01 '13 14:06 coveralls