summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-17 10:28:50 +0100
committerDouwe Maan <douwe@gitlab.com>2015-03-18 14:08:26 +0100
commit88f9ed3d196776295294d540556216b95d0bcd60 (patch)
tree385473ef3d9f6283ee8ed2639766f1722c13c298
parentdbd347bfa00e133da8ac178612ed8c30ef871ca4 (diff)
downloadgitlab-ce-88f9ed3d196776295294d540556216b95d0bcd60.tar.gz
Move finding of contributing file from tree to repository.
-rw-r--r--app/models/repository.rb7
-rw-r--r--app/models/tree.rb7
2 files changed, 7 insertions, 7 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 47758b8ad68..9e82d79ec8c 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -197,7 +197,12 @@ class Repository
end
def contribution_guide
- cache.fetch(:contribution_guide) { tree(:head).contribution_guide }
+ cache.fetch(:contribution_guide) do
+ tree(:head).blobs.find do |file|
+ file.contributing?
+ end
+ end
+ end
end
def head_commit
diff --git a/app/models/tree.rb b/app/models/tree.rb
index 4f5d81f0a5e..9095fb134ff 100644
--- a/app/models/tree.rb
+++ b/app/models/tree.rb
@@ -1,7 +1,7 @@
class Tree
include Gitlab::MarkdownHelper
- attr_accessor :entries, :readme, :contribution_guide
+ attr_accessor :entries, :readme
def initialize(repository, sha, path = '/')
path = '/' if path.blank?
@@ -28,11 +28,6 @@ class Tree
readme_path = path == '/' ? readme_tree.name : File.join(path, readme_tree.name)
@readme = Gitlab::Git::Blob.find(git_repo, sha, readme_path)
end
-
- if contribution_tree = @entries.find(&:contributing?)
- contribution_path = path == '/' ? contribution_tree.name : File.join(path, contribution_tree.name)
- @contribution_guide = Gitlab::Git::Blob.find(git_repo, sha, contribution_path)
- end
end
def trees