Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
0dafea86
Commit
0dafea86
authored
Feb 18, 2018
by
Maxime Roussin-Belanger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing pagination on the commit diff endpoint
parent
cd82683e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
changelogs/unreleased/17203-add-missing-pagination-commit-diff-endpoint.yml
...sed/17203-add-missing-pagination-commit-diff-endpoint.yml
+5
-0
lib/api/commits.rb
lib/api/commits.rb
+4
-1
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+1
-0
No files found.
changelogs/unreleased/17203-add-missing-pagination-commit-diff-endpoint.yml
0 → 100644
View file @
0dafea86
---
title
:
Add missing pagination on the commit diff endpoint
merge_request
:
17203
author
:
Maxime Roussin-Bélanger
type
:
fixed
lib/api/commits.rb
View file @
0dafea86
...
...
@@ -97,13 +97,16 @@ module API
end
params
do
requires
:sha
,
type:
String
,
desc:
'A commit sha, or the name of a branch or tag'
use
:pagination
end
get
':id/repository/commits/:sha/diff'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
commit
=
user_project
.
commit
(
params
[
:sha
])
not_found!
'Commit'
unless
commit
present
commit
.
raw_diffs
.
to_a
,
with:
Entities
::
Diff
raw_diffs
=
::
Kaminari
.
paginate_array
(
commit
.
raw_diffs
.
to_a
)
present
paginate
(
raw_diffs
),
with:
Entities
::
Diff
end
desc
"Get a commit's comments"
do
...
...
spec/requests/api/commits_spec.rb
View file @
0dafea86
...
...
@@ -698,6 +698,7 @@ describe API::Commits do
get
api
(
route
,
current_user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
size
).
to
be
>=
1
expect
(
json_response
.
first
.
keys
).
to
include
'diff'
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment