summaryrefslogtreecommitdiff
path: root/app/models/tree.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-11-08 16:42:28 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-11-21 12:51:40 +0100
commitdf5548e19e8c988b709e66a7e35ddc097344913e (patch)
tree66f29c2e8d8d10de461c229e132f086d5a691ff6 /app/models/tree.rb
parentb98193c55edc94b3ecf1ff143ac85fa9e9d8f029 (diff)
downloadgitlab-ce-df5548e19e8c988b709e66a7e35ddc097344913e.tar.gz
Unify detecting of special repository files
This moves the logic of detecting special repository files (e.g. a README or a Koding configuration file) to a single class: Gitlab::FileDetector. Moving this logic into a single place allows this to be re-used more easily. This commit also changes Repository#gitlab_ci_yaml so that its cached similar to other data (e.g. the Koding configuration file).
Diffstat (limited to 'app/models/tree.rb')
-rw-r--r--app/models/tree.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/tree.rb b/app/models/tree.rb
index 2d1d68dbd81..fe148b0ec65 100644
--- a/app/models/tree.rb
+++ b/app/models/tree.rb
@@ -18,7 +18,9 @@ class Tree
def readme
return @readme if defined?(@readme)
- available_readmes = blobs.select(&:readme?)
+ available_readmes = blobs.select do |blob|
+ Gitlab::FileDetector.type_of(blob.name) == :readme
+ end
previewable_readmes = available_readmes.select do |blob|
previewable?(blob.name)