Commit a9d359b4 authored by Stan Hu's avatar Stan Hu

Remove unnecessary lookup for merge request SHAs

parent 2aa4d7f1
...@@ -149,21 +149,16 @@ module Gitlab ...@@ -149,21 +149,16 @@ module Gitlab
description += @formatter.author_line(pull_request.author) unless find_user_id(pull_request.author) description += @formatter.author_line(pull_request.author) unless find_user_id(pull_request.author)
description += pull_request.description 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!( merge_request = project.merge_requests.create!(
iid: pull_request.iid, iid: pull_request.iid,
title: pull_request.title, title: pull_request.title,
description: description, description: description,
source_project: project, source_project: project,
source_branch: pull_request.source_branch_name, source_branch: pull_request.source_branch_name,
source_branch_sha: source_branch_sha, source_branch_sha: pull_request.source_branch_sha,
target_project: project, target_project: project,
target_branch: pull_request.target_branch_name, target_branch: pull_request.target_branch_name,
target_branch_sha: target_branch_sha, target_branch_sha: pull_request.target_branch_sha,
state: pull_request.state, state: pull_request.state,
author_id: gitlab_user_id(project, pull_request.author), author_id: gitlab_user_id(project, pull_request.author),
assignee_id: nil, assignee_id: nil,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment