diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 15:09:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 15:09:30 +0000 |
commit | c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (patch) | |
tree | 967afee9a510ff9dd503ebd83706dc760ec2e3ed /app/models/snippet.rb | |
parent | 903ccf7c93eb9490c76857bffe744249cc07de09 (diff) | |
download | gitlab-ce-c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r-- | app/models/snippet.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index cfe1c77ec48..821de70f9d9 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -258,10 +258,12 @@ class Snippet < ApplicationRecord super end + override :repository def repository @repository ||= Repository.new(full_path, self, shard: repository_storage, disk_path: disk_path, repo_type: Gitlab::GlRepository::SNIPPET) end + override :repository_size_checker def repository_size_checker strong_memoize(:repository_size_checker) do ::Gitlab::RepositorySizeChecker.new( @@ -271,6 +273,7 @@ class Snippet < ApplicationRecord end end + override :storage def storage @storage ||= Storage::Hashed.new(self, prefix: Storage::Hashed::SNIPPET_REPOSITORY_PATH_PREFIX) end @@ -278,6 +281,7 @@ class Snippet < ApplicationRecord # This is the full_path used to identify the # the snippet repository. It will be used mostly # for logging purposes. + override :full_path def full_path return unless persisted? @@ -290,10 +294,6 @@ class Snippet < ApplicationRecord end end - def url_to_repo - Gitlab::Shell.url_to_repo(full_path.delete('@')) - end - def repository_storage snippet_repository&.shard_name || self.class.pick_repository_storage end |