diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-12-04 14:31:15 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-12-04 14:31:15 +0300 |
commit | 50eb125282ba83e71447161ee2add396fa5eef9b (patch) | |
tree | 55352ccc9470cf397ffe6efdc85db3f5432e6068 /app | |
parent | ae1c0c4e759abdb534bf2b029769f698667ae2a6 (diff) | |
parent | 327a9898a226a098b18e80e4950702064ecd38f1 (diff) |
Merge branch '40711-fix-forking-hashed-projects' into 'master'
Fix the fork project functionality for projects with hashed storage
Closes #40711
See merge request gitlab-org/gitlab-ce!15671
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 3 | ||||
-rw-r--r-- | app/workers/repository_fork_worker.rb | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index eaf4f555d3b..f9c82029912 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -562,8 +562,7 @@ class Project < ActiveRecord::Base if forked? RepositoryForkWorker.perform_async(id, forked_from_project.repository_storage_path, - forked_from_project.full_path, - self.namespace.full_path) + forked_from_project.disk_path) else RepositoryImportWorker.perform_async(self.id) end diff --git a/app/workers/repository_fork_worker.rb b/app/workers/repository_fork_worker.rb index 264706e3e23..001c11b73e1 100644 --- a/app/workers/repository_fork_worker.rb +++ b/app/workers/repository_fork_worker.rb @@ -8,18 +8,18 @@ class RepositoryForkWorker sidekiq_options status_expiration: StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION - def perform(project_id, forked_from_repository_storage_path, source_path, target_path) + def perform(project_id, forked_from_repository_storage_path, source_disk_path) project = Project.find(project_id) return unless start_fork(project) Gitlab::Metrics.add_event(:fork_repository, - source_path: source_path, - target_path: target_path) + source_path: source_disk_path, + target_path: project.disk_path) - result = gitlab_shell.fork_repository(forked_from_repository_storage_path, source_path, - project.repository_storage_path, target_path) - raise ForkError, "Unable to fork project #{project_id} for repository #{source_path} -> #{target_path}" unless result + result = gitlab_shell.fork_repository(forked_from_repository_storage_path, source_disk_path, + project.repository_storage_path, project.disk_path) + raise ForkError, "Unable to fork project #{project_id} for repository #{source_disk_path} -> #{project.disk_path}" unless result project.repository.after_import raise ForkError, "Project #{project_id} had an invalid repository after fork" unless project.valid_repo? |