Commit 9adcd62d authored by Nick Thomas's avatar Nick Thomas

Merge branch 'rs-cherry-pick-api' into 'master'

Resolve possible cherry pick API race condition

Closes #53773

See merge request gitlab-org/gitlab-ce!22946
parents 32bf2667 11dd9d6e
---
title: Resolve possible cherry pick API race condition
merge_request:
author:
type: fixed
......@@ -194,11 +194,13 @@ module API
branch_name: params[:branch]
}
result = ::Commits::CherryPickService.new(user_project, current_user, commit_params).execute
result = ::Commits::CherryPickService
.new(user_project, current_user, commit_params)
.execute
if result[:status] == :success
branch = find_branch!(params[:branch])
present user_project.repository.commit(branch.dereferenced_target), with: Entities::Commit
present user_project.repository.commit(result[:result]),
with: Entities::Commit
else
render_api_error!(result[:message], 400)
end
......
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