Commit 950c8730 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Move create_repository back to project model as we can use disk_path and share it

parent cdafffcf
...@@ -59,18 +59,5 @@ module Storage ...@@ -59,18 +59,5 @@ module Storage
Gitlab::UploadsTransfer.new.rename_project(path_was, path, namespace.full_path) Gitlab::UploadsTransfer.new.rename_project(path_was, path, namespace.full_path)
Gitlab::PagesTransfer.new.rename_project(path_was, path, namespace.full_path) Gitlab::PagesTransfer.new.rename_project(path_was, path, namespace.full_path)
end end
def create_repository(force: false)
# Forked import is handled asynchronously
return if forked? && !force
if gitlab_shell.add_repository(repository_storage_path, path_with_namespace)
repository.after_create
true
else
errors.add(:base, 'Failed to create repository via gitlab-shell')
false
end
end
end end
end end
...@@ -993,6 +993,19 @@ class Project < ActiveRecord::Base ...@@ -993,6 +993,19 @@ class Project < ActiveRecord::Base
end end
end end
def create_repository(force: false)
# Forked import is handled asynchronously
return if forked? && !force
if gitlab_shell.add_repository(repository_storage_path, disk_path)
repository.after_create
true
else
errors.add(:base, 'Failed to create repository via gitlab-shell')
false
end
end
def hook_attrs(backward: true) def hook_attrs(backward: true)
attrs = { attrs = {
name: name, name: name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment