diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 18:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 18:08:52 +0300 |
commit | 0ab47b994caa80c5587f33dc818626b66cfdafe2 (patch) | |
tree | 5ef3976d2f84e3368903a67ba2dbd87a74b9a43c /app/models/storage | |
parent | 1308dc5eb484ab0f8064989fc551ebdb4b1a7976 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/storage')
-rw-r--r-- | app/models/storage/hashed.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/models/storage/hashed.rb b/app/models/storage/hashed.rb index 898e75194db..3dea50ab98b 100644 --- a/app/models/storage/hashed.rb +++ b/app/models/storage/hashed.rb @@ -2,14 +2,15 @@ module Storage class Hashed - attr_accessor :project - delegate :gitlab_shell, :repository_storage, to: :project + attr_accessor :container + delegate :gitlab_shell, :repository_storage, to: :container REPOSITORY_PATH_PREFIX = '@hashed' + SNIPPET_REPOSITORY_PATH_PREFIX = '@snippets' POOL_PATH_PREFIX = '@pools' - def initialize(project, prefix: REPOSITORY_PATH_PREFIX) - @project = project + def initialize(container, prefix: REPOSITORY_PATH_PREFIX) + @container = container @prefix = prefix end @@ -20,9 +21,10 @@ module Storage "#{@prefix}/#{disk_hash[0..1]}/#{disk_hash[2..3]}" if disk_hash end - # Disk path is used to build repository and project's wiki path on disk + # Disk path is used to build repository path on disk # - # @return [String] combination of base_dir and the repository own name without `.git` or `.wiki.git` extensions + # @return [String] combination of base_dir and the repository own name + # without `.git`, `.wiki.git`, or any other extension def disk_path "#{base_dir}/#{disk_hash}" if disk_hash end @@ -33,10 +35,10 @@ module Storage private - # Generates the hash for the project path and name on disk + # Generates the hash for the repository path and name on disk # If you need to refer to the repository on disk, use the `#disk_path` def disk_hash - @disk_hash ||= Digest::SHA2.hexdigest(project.id.to_s) if project.id + @disk_hash ||= Digest::SHA2.hexdigest(container.id.to_s) if container.id end end end |