Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-27 06:08:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-27 06:08:49 +0300
commit996c6bf06f602ada62e3f754c121c17051072892 (patch)
treec7568793468de0faef693795e00f34c07da8e793 /app/models
parent0a0e82d1440b06650e5fc524168b1f50a8feec68 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb6
-rw-r--r--app/models/project_wiki.rb2
-rw-r--r--app/models/repository.rb9
-rw-r--r--app/models/snippet.rb2
4 files changed, 10 insertions, 9 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 6ff5016be03..0f61d32eb8d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -780,7 +780,7 @@ class Project < ApplicationRecord
end
def repository
- @repository ||= Repository.new(full_path, self, disk_path: disk_path)
+ @repository ||= Repository.new(full_path, self, shard: repository_storage, disk_path: disk_path)
end
def cleanup
@@ -1411,8 +1411,8 @@ class Project < ApplicationRecord
# Expires various caches before a project is renamed.
def expire_caches_before_rename(old_path)
- repo = Repository.new(old_path, self)
- wiki = Repository.new("#{old_path}.wiki", self)
+ repo = Repository.new(old_path, self, shard: repository_storage)
+ wiki = Repository.new("#{old_path}.wiki", self, shard: repository_storage, repo_type: Gitlab::GlRepository::WIKI)
if repo.exists?
repo.before_delete
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 1abde5196de..7529047a73a 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -170,7 +170,7 @@ class ProjectWiki
end
def repository
- @repository ||= Repository.new(full_path, @project, disk_path: disk_path, repo_type: Gitlab::GlRepository::WIKI)
+ @repository ||= Repository.new(full_path, @project, shard: repository_storage, disk_path: disk_path, repo_type: Gitlab::GlRepository::WIKI)
end
def default_branch
diff --git a/app/models/repository.rb b/app/models/repository.rb
index a53850bb068..beb65ff26fd 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -22,7 +22,7 @@ class Repository
include Gitlab::RepositoryCacheAdapter
- attr_accessor :full_path, :disk_path, :container, :repo_type
+ attr_accessor :full_path, :shard, :disk_path, :container, :repo_type
delegate :ref_name_for_sha, to: :raw_repository
delegate :bundle_to_disk, to: :raw_repository
@@ -65,8 +65,9 @@ class Repository
xcode_config: :xcode_project?
}.freeze
- def initialize(full_path, container, disk_path: nil, repo_type: Gitlab::GlRepository::PROJECT)
+ def initialize(full_path, container, shard:, disk_path: nil, repo_type: Gitlab::GlRepository::PROJECT)
@full_path = full_path
+ @shard = shard
@disk_path = disk_path || full_path
@container = container
@commit_cache = {}
@@ -95,7 +96,7 @@ class Repository
def path_to_repo
@path_to_repo ||=
begin
- storage = Gitlab.config.repositories.storages[container.repository_storage]
+ storage = Gitlab.config.repositories.storages[shard]
File.expand_path(
File.join(storage.legacy_disk_path, disk_path + '.git')
@@ -1181,7 +1182,7 @@ class Repository
end
def initialize_raw_repository
- Gitlab::Git::Repository.new(container.repository_storage,
+ Gitlab::Git::Repository.new(shard,
disk_path + '.git',
repo_type.identifier_for_container(container),
container.full_path)
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 8f162f17ac5..8bba79bd944 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -261,7 +261,7 @@ class Snippet < ApplicationRecord
end
def repository
- @repository ||= Repository.new(full_path, self, disk_path: disk_path, repo_type: Gitlab::GlRepository::SNIPPET)
+ @repository ||= Repository.new(full_path, self, shard: repository_storage, disk_path: disk_path, repo_type: Gitlab::GlRepository::SNIPPET)
end
def storage