diff options
author | Rémy Coutable <remy@rymai.me> | 2018-03-28 14:24:05 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-03-28 14:24:05 +0000 |
commit | fffa19cbb623e42d2cea5369e3c853f1ee96033e (patch) | |
tree | 863ce3f1101704d28638e08cb16461353dbc1cc5 /lib/api | |
parent | d7a9df68329bee42a4f2c4934351022c949f7c71 (diff) | |
parent | 847671e06c13155c02d8f0be3565705cd89969ee (diff) | |
download | gitlab-ce-fffa19cbb623e42d2cea5369e3c853f1ee96033e.tar.gz |
Merge branch 'expose-commits-mr-api' into 'master'
Allow merge requests related to a commit to be found via API
See merge request gitlab-org/gitlab-ce!18004
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/commits.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 982f45425a3..684955a1b24 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -231,6 +231,20 @@ module API render_api_error!("Failed to save note #{note.errors.messages}", 400) end end + + desc 'Get Merge Requests associated with a commit' do + success Entities::MergeRequestBasic + end + params do + requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag on which to find Merge Requests' + use :pagination + end + get ':id/repository/commits/:sha/merge_requests', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do + commit = user_project.commit(params[:sha]) + not_found! 'Commit' unless commit + + present paginate(commit.merge_requests), with: Entities::MergeRequestBasic + end end end end |