Commit 41c06c31 authored by James Lopez's avatar James Lopez

refactoring more things based on MR feedback

parent a9fdf62b
......@@ -45,7 +45,8 @@ module Gitlab
def wiki_restorer
Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: wiki_repo_path,
shared: @shared,
project: ProjectWiki.new(project_tree.project))
project: ProjectWiki.new(project_tree.project),
wiki: true)
end
def uploads_restorer
......
......@@ -30,7 +30,7 @@ module Gitlab
set_note_author if @relation_name == :notes
update_user_references
update_project_references
reset_tokens if @relation_name == 'Ci::Trigger'
reset_ci_tokens if @relation_name == 'Ci::Trigger'
generate_imported_object
end
......@@ -95,10 +95,10 @@ module Gitlab
end
end
def reset_tokens
def reset_ci_tokens
return unless Gitlab::ImportExport.reset_tokens?
# If we import/export a project to the same instance, tokens will have to be reseated.
# If we import/export a project to the same instance, tokens will have to be reset.
@relation_hash['token'] = nil
end
......
......@@ -3,14 +3,15 @@ module Gitlab
class RepoRestorer
include Gitlab::ImportExport::CommandLineUtil
def initialize(project:, shared:, path_to_bundle:)
def initialize(project:, shared:, path_to_bundle:, wiki: false)
@project = project
@path_to_bundle = path_to_bundle
@shared = shared
@wiki = wiki
end
def restore
return true unless File.exists?(@path_to_bundle)
return false unless File.exists?(@path_to_bundle) || wiki?
FileUtils.mkdir_p(path_to_repo)
......@@ -29,6 +30,10 @@ module Gitlab
def path_to_repo
@project.repository.path_to_repo
end
def wiki?
@wiki
end
end
end
end
......@@ -10,7 +10,7 @@ module Gitlab
end
def export_path
@export_path ||= Gitlab::ImportExport.export_path(relative_path: @opts[:relative_path])
@export_path ||= Gitlab::ImportExport.export_path(relative_path: opts[:relative_path])
end
def error(error)
......
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