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:
Diffstat (limited to 'lib/gitlab/bitbucket_server_import/importers/pull_request_importer.rb')
-rw-r--r--lib/gitlab/bitbucket_server_import/importers/pull_request_importer.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/bitbucket_server_import/importers/pull_request_importer.rb b/lib/gitlab/bitbucket_server_import/importers/pull_request_importer.rb
index 34963452192..0d4de385f5e 100644
--- a/lib/gitlab/bitbucket_server_import/importers/pull_request_importer.rb
+++ b/lib/gitlab/bitbucket_server_import/importers/pull_request_importer.rb
@@ -30,7 +30,7 @@ module Gitlab
reviewer_ids: reviewers,
source_project_id: project.id,
source_branch: Gitlab::Git.ref_name(object[:source_branch_name]),
- source_branch_sha: object[:source_branch_sha],
+ source_branch_sha: source_branch_sha,
target_project_id: project.id,
target_branch: Gitlab::Git.ref_name(object[:target_branch_name]),
target_branch_sha: object[:target_branch_sha],
@@ -68,6 +68,14 @@ module Gitlab
end
end
end
+
+ def source_branch_sha
+ source_branch_sha = project.repository.commit(object[:source_branch_sha])&.sha
+
+ return source_branch_sha if source_branch_sha
+
+ project.repository.find_commits_by_message(object[:source_branch_sha])&.first&.sha
+ end
end
end
end