summaryrefslogtreecommitdiff
path: root/lib/api/commits.rb
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2018-09-08 10:55:17 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2018-09-08 10:55:17 +0200
commita14e9cfde83c708791ba6a66b45addbe719c9a1d (patch)
tree75bf894365c44e400479cd939cecad92e2c6b38d /lib/api/commits.rb
parentec54fd36e991b2c19b4e4d07342a6f3a1de2d8b1 (diff)
downloadgitlab-ce-a14e9cfde83c708791ba6a66b45addbe719c9a1d.tar.gz
API: Use find_branch! in all places
Diffstat (limited to 'lib/api/commits.rb')
-rw-r--r--lib/api/commits.rb5
1 files changed, 2 insertions, 3 deletions
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)