Permalink
Browse files

Merge pull request #49 from carlosmn/file-at

Repository#file_at: don't throw an exception on nonexistent path
  • Loading branch information...
vmg committed Apr 28, 2012
2 parents d50491e + cb41776 commit d1ea59e923af75b618a85c4d2d68470a8833867d
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/rugged/repository.rb
View
@@ -117,8 +117,9 @@ def file_at(revision, path)
tree = Rugged::Commit.lookup(self, revision).tree
subtree = tree.get_subtree(path)
blob_data = subtree.get_entry(File.basename path)
+ return nil unless blob_data
blob = Rugged::Blob.lookup(self, blob_data[:oid])
blob.content
end
end
-end
+end

0 comments on commit d1ea59e

Please sign in to comment.