grit
grit copied to clipboard
Get blob path (eg. @blob.path = 'lib/grit/blob.rb')
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"