diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-21 18:21:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-21 18:21:10 +0300 |
commit | e33f87ac0fabaab468ce4b457996cc0f1b1bb648 (patch) | |
tree | 8bf0de72a9acac014cfdaddab7d463b208294af2 /app/models/snippet.rb | |
parent | 5baf990db20a75078684702782c24399ef9eb0fa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r-- | app/models/snippet.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index dbf600cf0df..7bff6d02910 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -322,6 +322,12 @@ class Snippet < ApplicationRecord ::Feature.enabled?(:version_snippets, user) && repository_exists? end + def file_name_on_repo + return if repository.empty? + + repository.ls_files(repository.root_ref).first + end + class << self # Searches for snippets with a matching title, description or file name. # |