summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index aedca5ed61d..271c2e4dbbc 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -163,7 +163,19 @@ class Repository
def readme
Rails.cache.fetch(cache_key(:readme)) do
- Tree.new(self, self.root_ref).readme
+ tree(:head).readme
end
end
+
+ def head_commit
+ commit(self.root_ref)
+ end
+
+ def tree(sha = :head, path = nil)
+ if sha == :head
+ sha = head_commit.sha
+ end
+
+ Tree.new(self, sha, path)
+ end
end