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>2023-08-18 13:50:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-18 13:50:51 +0300
commitdb384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch)
tree34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/models/pool_repository.rb
parent54fd7b1bad233e3944434da91d257fa7f63c3996 (diff)
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/models/pool_repository.rb')
-rw-r--r--app/models/pool_repository.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/pool_repository.rb b/app/models/pool_repository.rb
index f22a63ee980..bc3898fafe7 100644
--- a/app/models/pool_repository.rb
+++ b/app/models/pool_repository.rb
@@ -12,7 +12,13 @@ class PoolRepository < ApplicationRecord
has_many :member_projects, class_name: 'Project'
- after_create :correct_disk_path
+ after_create :set_disk_path
+
+ scope :by_source_project, ->(project) { where(source_project: project) }
+ scope :by_source_project_and_shard_name, ->(project, shard_name) do
+ by_source_project(project)
+ .for_repository_storage(shard_name)
+ end
state_machine :state, initial: :none do
state :scheduled
@@ -107,8 +113,8 @@ class PoolRepository < ApplicationRecord
private
- def correct_disk_path
- update!(disk_path: storage.disk_path)
+ def set_disk_path
+ update!(disk_path: storage.disk_path) if disk_path.blank?
end
def storage