Commit c7569fb6 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix/import-no-repo' into 'master'

Allow empty repos on import/export

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19849

See merge request !5312
parents 240a4aa6 c1573053
...@@ -111,6 +111,7 @@ v 8.10.0 (unreleased) ...@@ -111,6 +111,7 @@ v 8.10.0 (unreleased)
- Fix creating group with space in group path - Fix creating group with space in group path
- Create Todos for Issue author when assign or mention himself (Katarzyna Kobierska) - Create Todos for Issue author when assign or mention himself (Katarzyna Kobierska)
- Limit the number of retries on error to 3 for exporting projects - Limit the number of retries on error to 3 for exporting projects
- Allow empty repositories on project import/export
v 8.9.6 v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154 - Fix importing of events under notes for GitLab projects. !5154
......
...@@ -44,8 +44,7 @@ module Gitlab ...@@ -44,8 +44,7 @@ module Gitlab
def wiki_restorer def wiki_restorer
Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: wiki_repo_path, Gitlab::ImportExport::RepoRestorer.new(path_to_bundle: wiki_repo_path,
shared: @shared, shared: @shared,
project: ProjectWiki.new(project_tree.restored_project), project: ProjectWiki.new(project_tree.restored_project))
wiki: true)
end end
def uploads_restorer def uploads_restorer
......
...@@ -3,15 +3,14 @@ module Gitlab ...@@ -3,15 +3,14 @@ module Gitlab
class RepoRestorer class RepoRestorer
include Gitlab::ImportExport::CommandLineUtil include Gitlab::ImportExport::CommandLineUtil
def initialize(project:, shared:, path_to_bundle:, wiki: false) def initialize(project:, shared:, path_to_bundle:)
@project = project @project = project
@path_to_bundle = path_to_bundle @path_to_bundle = path_to_bundle
@shared = shared @shared = shared
@wiki = wiki
end end
def restore def restore
return wiki? unless File.exist?(@path_to_bundle) return true unless File.exist?(@path_to_bundle)
FileUtils.mkdir_p(path_to_repo) FileUtils.mkdir_p(path_to_repo)
...@@ -30,10 +29,6 @@ module Gitlab ...@@ -30,10 +29,6 @@ module Gitlab
def path_to_repo def path_to_repo
@project.repository.path_to_repo @project.repository.path_to_repo
end end
def wiki?
@wiki
end
end end
end end
end end
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
end end
def save def save
return false if @project.empty_repo? return true if @project.empty_repo? # it's ok to have no repo
@full_path = File.join(@shared.export_path, ImportExport.project_bundle_filename) @full_path = File.join(@shared.export_path, ImportExport.project_bundle_filename)
bundle_to_disk bundle_to_disk
......
...@@ -4,6 +4,7 @@ module Gitlab ...@@ -4,6 +4,7 @@ module Gitlab
def save def save
@wiki = ProjectWiki.new(@project) @wiki = ProjectWiki.new(@project)
return true unless wiki_repository_exists? # it's okay to have no Wiki return true unless wiki_repository_exists? # it's okay to have no Wiki
bundle_to_disk(File.join(@shared.export_path, project_filename)) bundle_to_disk(File.join(@shared.export_path, project_filename))
end end
......
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