diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-10-16 15:14:42 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-10-16 15:14:42 +0000 |
commit | 38ff8cd13d447825d74e9496cb9c72bedb6e0f7e (patch) | |
tree | 96a1a9f8c87813dca67608385ec67784d1626e36 /lib/api/commits.rb | |
parent | 07e330896755b5a84f92042e7437ab78dfeeaae4 (diff) | |
parent | 771b777ab57d1c8d323ecc08a9e2cdc4f6a01e0b (diff) | |
download | gitlab-ce-38ff8cd13d447825d74e9496cb9c72bedb6e0f7e.tar.gz |
Merge branch 'sha-handling' into 'master'
Adds requirements that supports anything in sha params
Closes #26561 and #2709
See merge request gitlab-org/gitlab-ce!14462
Diffstat (limited to 'lib/api/commits.rb')
-rw-r--r-- | lib/api/commits.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 62565e2d522..2685dc27252 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -4,8 +4,6 @@ module API class Commits < Grape::API include PaginationParams - COMMIT_ENDPOINT_REQUIREMENTS = API::PROJECT_ENDPOINT_REQUIREMENTS.merge(sha: API::NO_SLASH_URL_PART_REGEX) - before { authorize! :download_code, user_project } params do @@ -85,7 +83,7 @@ module API params do requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag' end - get ':id/repository/commits/:sha', requirements: COMMIT_ENDPOINT_REQUIREMENTS do + get ':id/repository/commits/:sha', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do commit = user_project.commit(params[:sha]) not_found! 'Commit' unless commit @@ -99,7 +97,7 @@ module API params do requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag' end - get ':id/repository/commits/:sha/diff', requirements: COMMIT_ENDPOINT_REQUIREMENTS do + get ':id/repository/commits/:sha/diff', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do commit = user_project.commit(params[:sha]) not_found! 'Commit' unless commit @@ -115,7 +113,7 @@ module API use :pagination requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag' end - get ':id/repository/commits/:sha/comments', requirements: COMMIT_ENDPOINT_REQUIREMENTS do + get ':id/repository/commits/:sha/comments', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do commit = user_project.commit(params[:sha]) not_found! 'Commit' unless commit @@ -132,7 +130,7 @@ module API requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag to be cherry picked' requires :branch, type: String, desc: 'The name of the branch' end - post ':id/repository/commits/:sha/cherry_pick', requirements: COMMIT_ENDPOINT_REQUIREMENTS do + post ':id/repository/commits/:sha/cherry_pick', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do authorize! :push_code, user_project commit = user_project.commit(params[:sha]) @@ -169,7 +167,7 @@ module API requires :line_type, type: String, values: %w(new old), default: 'new', desc: 'The type of the line' end end - post ':id/repository/commits/:sha/comments', requirements: COMMIT_ENDPOINT_REQUIREMENTS do + post ':id/repository/commits/:sha/comments', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do commit = user_project.commit(params[:sha]) not_found! 'Commit' unless commit |