提交 d96098e9 编写于 作者: D Dmitriy Zaporozhets

Cache head commit and head tree

上级 c378d20c
......@@ -248,12 +248,20 @@ class Repository
end
def head_commit
commit(self.root_ref)
@head_commit ||= commit(self.root_ref)
end
def head_tree
@head_tree ||= Tree.new(self, head_commit.sha, nil)
end
def tree(sha = :head, path = nil)
if sha == :head
sha = head_commit.sha
if path.nil?
return head_tree
else
sha = head_commit.sha
end
end
Tree.new(self, sha, path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册