Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-06-12 14:29:43 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2018-06-12 14:30:41 +0300
commite4612df0e257a27b47986a9ee6aa77f68a9cd3ba (patch)
tree36ad42e8f6653d3967a44dcf4478ca8828556e7f /lib/gitlab/github_import
parent450b9f6e30161e6719cf9ffb051b460eb48378c4 (diff)
Ensure MR diffs always exist in the PR importer
In rare cases it could happen that an MR was created, but creating the MR diffs somehow failed (e.g. due to an error). This commit adds an additional check to make sure MR diffs are always present when importing GitHub pull requests.
Diffstat (limited to 'lib/gitlab/github_import')
-rw-r--r--lib/gitlab/github_import/importer/pull_request_importer.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/github_import/importer/pull_request_importer.rb b/lib/gitlab/github_import/importer/pull_request_importer.rb
index b2f6cb7ad19..6b3688c4381 100644
--- a/lib/gitlab/github_import/importer/pull_request_importer.rb
+++ b/lib/gitlab/github_import/importer/pull_request_importer.rb
@@ -104,7 +104,8 @@ module Gitlab
# first save the diff, then populate it.
diff =
if already_exists
- merge_request.merge_request_diffs.take
+ merge_request.merge_request_diffs.take ||
+ merge_request.merge_request_diffs.build
else
merge_request.merge_request_diffs.build
end