diff options
author | Nick Thomas <nick@gitlab.com> | 2018-11-09 17:29:19 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-11-09 17:29:19 +0000 |
commit | 9adcd62df3831b7b3bee86e7ee9793b5156fe46b (patch) | |
tree | e2e6bedc26d70558bc75cb9bb080d0d991a6faa3 /lib/api | |
parent | 32bf2667d26cd13ec4d9c640efb5c1042a946f5b (diff) | |
parent | 11dd9d6e1f18b75926a4ae2284dce2343d2b5230 (diff) | |
download | gitlab-ce-9adcd62df3831b7b3bee86e7ee9793b5156fe46b.tar.gz |
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
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/commits.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 1b228069005..3b8f3fedccf 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -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 |