Method: Rugged::Repository#blob_at
- Defined in:
- lib/rugged/repository.rb
permalink #blob_at(revision, path) ⇒ Object
Get the blob at a path for a specific revision.
revision - The String SHA1. path - The String file path.
Returns a Rugged::Blob object
242 243 244 245 246 247 248 249 250 251 |
# File 'lib/rugged/repository.rb', line 242 def blob_at(revision, path) tree = Rugged::Commit.lookup(self, revision).tree begin blob_data = tree.path(path) rescue Rugged::TreeError return nil end blob = Rugged::Blob.lookup(self, blob_data[:oid]) (blob.type == :blob) ? blob : nil end |