Commit 8cfa5ccf authored by Nick Thomas's avatar Nick Thomas

Merge branch '4826-github-import-wiki-fix-1' into 'master'

[GH Import] Create an empty wiki if wiki import failed

Closes #43020

See merge request gitlab-org/gitlab-ce!17112
parents 7511e47f 69b750ae
---
title: "[GitHub Import] Create an empty wiki if wiki import failed"
merge_request:
author:
type: fixed
...@@ -63,6 +63,7 @@ module Gitlab ...@@ -63,6 +63,7 @@ module Gitlab
true true
rescue Gitlab::Shell::Error => e rescue Gitlab::Shell::Error => e
if e.message !~ /repository not exported/ if e.message !~ /repository not exported/
project.create_wiki
fail_import("Failed to import the wiki: #{e.message}") fail_import("Failed to import the wiki: #{e.message}")
else else
true true
......
...@@ -11,7 +11,8 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do ...@@ -11,7 +11,8 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do
import_source: 'foo/bar', import_source: 'foo/bar',
repository_storage_path: 'foo', repository_storage_path: 'foo',
disk_path: 'foo', disk_path: 'foo',
repository: repository repository: repository,
create_wiki: true
) )
end end
...@@ -192,7 +193,7 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do ...@@ -192,7 +193,7 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do
expect(importer.import_wiki_repository).to eq(true) expect(importer.import_wiki_repository).to eq(true)
end end
it 'marks the import as failed if an error was raised' do it 'marks the import as failed and creates an empty repo if an error was raised' do
expect(importer.gitlab_shell) expect(importer.gitlab_shell)
.to receive(:import_repository) .to receive(:import_repository)
.and_raise(Gitlab::Shell::Error) .and_raise(Gitlab::Shell::Error)
...@@ -201,6 +202,9 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do ...@@ -201,6 +202,9 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do
.to receive(:fail_import) .to receive(:fail_import)
.and_return(false) .and_return(false)
expect(project)
.to receive(:create_wiki)
expect(importer.import_wiki_repository).to eq(false) expect(importer.import_wiki_repository).to eq(false)
end end
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