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:
authorDouwe Maan <douwe@selenight.nl>2017-09-22 12:27:27 +0300
committerDouwe Maan <douwe@selenight.nl>2017-09-25 11:22:28 +0300
commitc19d5ac1a2ac75fd7200aacae3514e5600a7f648 (patch)
treedcfd66cca529e4cf3b8b00f0a5e32ea85fd44df7 /lib/gitlab/bitbucket_import
parent4d88f6496836c7fbf8a0f58e4d2604bf2c3f96d5 (diff)
Expand truncated Bitbucket pull request source/target SHA if possible
Diffstat (limited to 'lib/gitlab/bitbucket_import')
-rw-r--r--lib/gitlab/bitbucket_import/importer.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb
index 28bbf3b384e..d1979bb7ed3 100644
--- a/lib/gitlab/bitbucket_import/importer.rb
+++ b/lib/gitlab/bitbucket_import/importer.rb
@@ -149,16 +149,21 @@ module Gitlab
description += @formatter.author_line(pull_request.author) unless find_user_id(pull_request.author)
description += pull_request.description
+ source_branch_sha = pull_request.source_branch_sha
+ target_branch_sha = pull_request.target_branch_sha
+ source_branch_sha = project.repository.commit(source_branch_sha)&.sha || source_branch_sha
+ target_branch_sha = project.repository.commit(target_branch_sha)&.sha || target_branch_sha
+
merge_request = project.merge_requests.create!(
iid: pull_request.iid,
title: pull_request.title,
description: description,
source_project: project,
source_branch: pull_request.source_branch_name,
- source_branch_sha: pull_request.source_branch_sha,
+ source_branch_sha: source_branch_sha,
target_project: project,
target_branch: pull_request.target_branch_name,
- target_branch_sha: pull_request.target_branch_sha,
+ target_branch_sha: target_branch_sha,
state: pull_request.state,
author_id: gitlab_user_id(project, pull_request.author),
assignee_id: nil,