summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2018-02-12 15:06:09 +0200
committerValery Sizov <valery@gitlab.com>2018-02-12 15:06:58 +0200
commit169bdaff7d0351b3c0a8d9937e1d0fcc9f2564bd (patch)
treeeb40dd43e82f342542edf3feee4d7b65dc27ffc6
parentbb2478c205932429e7e519aaaf2d9b655aecf860 (diff)
downloadgitlab-ce-4826-github-import-wiki-fix.tar.gz
[GH Import][ci skip] Create an empty wiki if GH project has no content in the wiki4826-github-import-wiki-fix
-rw-r--r--lib/gitlab/github_import/importer/repository_importer.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab/github_import/importer/repository_importer.rb b/lib/gitlab/github_import/importer/repository_importer.rb
index 7dd68a0d1cd..8231419f54a 100644
--- a/lib/gitlab/github_import/importer/repository_importer.rb
+++ b/lib/gitlab/github_import/importer/repository_importer.rb
@@ -58,11 +58,16 @@ module Gitlab
wiki_url = project.import_url.sub(/\.git\z/, '.wiki.git')
storage_path = project.repository_storage_path
+ if project.wiki_repository_exists? && project.wiki.repository.has_visible_content?
+ gitlab_shell.remove_repository(storage_path, wiki_path)
+ end
+
gitlab_shell.import_repository(storage_path, wiki_path, wiki_url)
true
rescue Gitlab::Shell::Error => e
if e.message !~ /repository not exported/
+ project.create_wiki
fail_import("Failed to import the wiki: #{e.message}")
else
true