diff options
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 13154eb4205..c07e8072043 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -467,6 +467,18 @@ class Repository end end + def gitlab_ci_yml + return nil if !exists? || empty? + + @gitlab_ci_yml ||= tree(:head).blobs.find do |file| + file.name == '.gitlab-ci.yml' + end + rescue Rugged::ReferenceError + # For unknow reason spinach scenario "Scenario: I change project path" + # lead to "Reference 'HEAD' not found" exception from Repository#empty? + nil + end + def head_commit @head_commit ||= commit(self.root_ref) end @@ -877,6 +889,8 @@ class Repository end def avatar + return nil unless exists? + @avatar ||= cache.fetch(:avatar) do AVATAR_FILES.find do |file| blob_at_branch('master', file) |