diff options
author | Jeremy Watson <jwatson@gitlab.com> | 2019-08-21 10:43:30 -0400 |
---|---|---|
committer | Jeremy Watson <jwatson@gitlab.com> | 2019-08-21 10:43:30 -0400 |
commit | aec4ce4ac538992ae09c8a9c77be62a22ea239f1 (patch) | |
tree | 0ec040a1d020a0096f60f1363db7fd1751967e9c /lib/api/files.rb | |
parent | ad799726ae697d12664b8c3903e8297e7bfb4088 (diff) | |
parent | ef0f1509dd2a2a3ba5798362e2be21108b705a85 (diff) | |
download | gitlab-ce-docs-group-managed-accounts.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into docs-group-managed-accountsdocs-group-managed-accounts
Diffstat (limited to 'lib/api/files.rb')
-rw-r--r-- | lib/api/files.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/api/files.rb b/lib/api/files.rb index ca59d330e1c..0b438fb5bbc 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -83,6 +83,31 @@ module API resource :projects, requirements: FILE_ENDPOINT_REQUIREMENTS do allow_access_with_scope :read_repository, if: -> (request) { request.get? || request.head? } + desc 'Get blame file metadata from repository' + params do + requires :file_path, type: String, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb' + requires :ref, type: String, desc: 'The name of branch, tag or commit', allow_blank: false + end + head ":id/repository/files/:file_path/blame", requirements: FILE_ENDPOINT_REQUIREMENTS do + assign_file_vars! + + set_http_headers(blob_data) + end + + desc 'Get blame file from the repository' + params do + requires :file_path, type: String, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb' + requires :ref, type: String, desc: 'The name of branch, tag or commit', allow_blank: false + end + get ":id/repository/files/:file_path/blame", requirements: FILE_ENDPOINT_REQUIREMENTS do + assign_file_vars! + + set_http_headers(blob_data) + + blame_ranges = Gitlab::Blame.new(@blob, @commit).groups(highlight: false) + present blame_ranges, with: Entities::BlameRange + end + desc 'Get raw file metadata from repository' params do requires :file_path, type: String, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb' |