summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-17 18:37:50 +0100
committerDouwe Maan <douwe@gitlab.com>2015-03-18 16:17:43 +0100
commitb1b8261f56d35e471bc32b0f2050e27650b7c797 (patch)
tree2fed6bd1da292a8348b838b208fad812bf500764 /app/models
parent5adb1128dcca2810a32b7b974372970c6d36a98c (diff)
downloadgitlab-ce-b1b8261f56d35e471bc32b0f2050e27650b7c797.tar.gz
Add license and contribution guide links to project sidebar.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 8d0306e820d..86c9c9b4d48 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -122,7 +122,7 @@ class Repository
def expire_cache
%i(size branch_names tag_names commit_count graph_log
- readme version contribution_guide changelog).each do |key|
+ readme version contribution_guide changelog license).each do |key|
cache.expire(key)
end
end
@@ -212,6 +212,14 @@ class Repository
end
end
+ def license
+ cache.fetch(:license) do
+ tree(:head).blobs.find do |file|
+ file.name =~ /^license/i
+ end
+ end
+ end
+
def head_commit
commit(self.root_ref)
end