diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-18 14:01:27 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-05-22 13:09:53 +0300 |
commit | 83cda43a00652d992cb2a47920db81cc0dae23e4 (patch) | |
tree | 5635981b7cf741892659fecb2fa8ca09f7f57e32 /app/models/repository.rb | |
parent | 83660e5712dde52767a0a22023785b9006b81c21 (diff) |
Fix Xcode project detection by looking for dirs instead of files
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 44c6bff6b66..0e1bf11d7c0 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -596,7 +596,7 @@ class Repository cache_method :gitlab_ci_yml def xcode_project? - file_on_head(:xcode_config).present? + file_on_head(:xcode_config, :tree).present? end cache_method :xcode_project? @@ -920,11 +920,21 @@ class Repository end end - def file_on_head(type) - if head = tree(:head) - head.blobs.find do |blob| - Gitlab::FileDetector.type_of(blob.path) == type + def file_on_head(type, object_type = :blob) + return unless head = tree(:head) + + objects = + case object_type + when :blob + head.blobs + when :tree + head.trees + else + raise ArgumentError, "Object type #{object_type} is not supported" end + + objects.find do |object| + Gitlab::FileDetector.type_of(object.path) == type end end |