summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gitlab/legacy_github_import/importer.rb7
-rw-r--r--spec/lib/gitlab/legacy_github_import/importer_spec.rb10
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/gitlab/legacy_github_import/importer.rb b/lib/gitlab/legacy_github_import/importer.rb
index 70b18221a66..751726d4810 100644
--- a/lib/gitlab/legacy_github_import/importer.rb
+++ b/lib/gitlab/legacy_github_import/importer.rb
@@ -55,7 +55,12 @@ module Gitlab
import_pull_requests
import_issues
import_comments(:issues)
- import_comments(:pull_requests)
+
+ # Gitea doesn't have an API endpoint for pull requests comments
+ unless project.gitea_import?
+ import_comments(:pull_requests)
+ end
+
import_wiki
# Gitea doesn't have a Release API yet
diff --git a/spec/lib/gitlab/legacy_github_import/importer_spec.rb b/spec/lib/gitlab/legacy_github_import/importer_spec.rb
index 6bc3792eb22..70a09c4bdc5 100644
--- a/spec/lib/gitlab/legacy_github_import/importer_spec.rb
+++ b/spec/lib/gitlab/legacy_github_import/importer_spec.rb
@@ -24,7 +24,13 @@ describe Gitlab::LegacyGithubImport::Importer do
end
expect(importer).to receive(:import_comments).with(:issues)
- expect(importer).to receive(:import_comments).with(:pull_requests)
+
+ if expected_not_called.include? :import_comments_pull_requests
+ expect(importer).not_to receive(:import_comments).with(:pull_requests)
+ expected_not_called.delete_at expected_not_called.index :import_comments_pull_requests
+ else
+ expect(importer).to receive(:import_comments).with(:pull_requests)
+ end
expected_not_called.each do |method_name|
expect(importer).not_to receive(method_name)
@@ -289,7 +295,7 @@ describe Gitlab::LegacyGithubImport::Importer do
end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute' do
- let(:expected_not_called) { [:import_releases] }
+ let(:expected_not_called) { [:import_releases, :import_comments_pull_requests] }
end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute an error occurs'
it_behaves_like 'Gitlab::LegacyGithubImport unit-testing'