summaryrefslogtreecommitdiff
path: root/app/models/snippet.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-06 15:08:05 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-06 15:08:05 +0000
commitf78257cbddd711e18cbce93ad740a4aa0acac347 (patch)
tree7f018abe3ce1c0010879cc480f348a35e616fabb /app/models/snippet.rb
parentf500600a43b531e2e7a5858b74bd35312b02c349 (diff)
downloadgitlab-ce-f78257cbddd711e18cbce93ad740a4aa0acac347.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r--app/models/snippet.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 770d9b5205c..27e1778e9b6 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -197,6 +197,8 @@ class Snippet < ApplicationRecord
end
def blobs
+ return [] unless repository_exists?
+
repository.ls_files(repository.root_ref).map { |file| Blob.lazy(self, repository.root_ref, file) }
end