From 09a05e97efe766712b042d2c708bb975b841714f Mon Sep 17 00:00:00 2001
From: Sarup Banskota <sbanskota08@gmail.com>
Date: Thu, 29 Jan 2015 22:22:25 +0530
Subject: [PATCH] Add tree_at similar to blob_at

---
 lib/rugged/repository.rb | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/rugged/repository.rb b/lib/rugged/repository.rb
index cbffb3b67..3af48dc9d 100644
--- a/lib/rugged/repository.rb
+++ b/lib/rugged/repository.rb
@@ -210,6 +210,17 @@ def fetch(remote_or_url, *args)
       remote_or_url.fetch(*args)
     end
 
+    # Get the tree at a path for a specific revision.
+    #
+    # revision - The String SHA1.
+    # path     - The String file path.
+    #
+    # Returns a String.
+    def tree_at(revision, path)
+      tree = Rugged::Commit.lookup(self, revision).tree
+      tree.path(path)[:oid]
+    end
+
     # Push a list of refspecs to the given remote.
     #
     # refspecs - A list of refspecs that should be pushed to the remote.