From a14e9cfde83c708791ba6a66b45addbe719c9a1d Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Sat, 8 Sep 2018 10:55:17 +0200 Subject: API: Use find_branch! in all places --- lib/api/commits.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/api/commits.rb') diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 92329465b2c..3e8de3c8dae 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -159,8 +159,7 @@ module API commit = user_project.commit(params[:sha]) not_found!('Commit') unless commit - branch = user_project.repository.find_branch(params[:branch]) - not_found!('Branch') unless branch + find_branch!(params[:branch]) commit_params = { commit: commit, @@ -171,7 +170,7 @@ module API result = ::Commits::CherryPickService.new(user_project, current_user, commit_params).execute if result[:status] == :success - branch = user_project.repository.find_branch(params[:branch]) + branch = find_branch!(params[:branch]) present user_project.repository.commit(branch.dereferenced_target), with: Entities::Commit else render_api_error!(result[:message], 400) -- cgit v1.2.1