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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
94eb5a4c
Commit
94eb5a4c
authored
Jan 30, 2020
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct the MR context commits endpoint
parent
a917e70c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
18 deletions
+12
-18
doc/api/merge_request_context_commits.md
doc/api/merge_request_context_commits.md
+1
-9
lib/api/entities.rb
lib/api/entities.rb
+0
-6
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+5
-3
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+6
-0
No files found.
doc/api/merge_request_context_commits.md
View file @
94eb5a4c
...
...
@@ -27,15 +27,7 @@ Parameters:
"authored_date"
:
"2017-04-11T10:08:59.000Z"
,
"committer_name"
:
"Luke
\"
Jared
\"
Bennett"
,
"committer_email"
:
"lbennett@gitlab.com"
,
"committed_date"
:
"2017-04-11T10:08:59.000Z"
,
"author"
:
null
,
"author_gravatar_url"
:
"https://www.gravatar.com/avatar/2acf1fb99417a2b3971def5a294abbeb?s=80&d=identicon"
,
"commit_url"
:
"http://127.0.0.1:3000/gitlab-org/gitlab-test/commit/4a24d82dbca5c11c61556f3b35ca472b7463187e"
,
"commit_path"
:
"/gitlab-org/gitlab-test/commit/4a24d82dbca5c11c61556f3b35ca472b7463187e"
,
"description_html"
:
""
,
"title_html"
:
"Update README.md to include `Usage in testing and development`"
,
"signature_html"
:
null
,
"pipeline_status_path"
:
null
"committed_date"
:
"2017-04-11T10:08:59.000Z"
}
]
```
...
...
lib/api/entities.rb
View file @
94eb5a4c
...
...
@@ -759,12 +759,6 @@ module API
end
end
class
MergeRequestContextCommit
<
Grape
::
Entity
expose
:sha
,
:relative_order
,
:new_file
,
:renamed_file
,
:deleted_file
,
:too_large
,
:a_mode
,
:b_mode
,
:new_path
,
:old_path
,
:diff
,
:binary
end
class
SSHKey
<
Grape
::
Entity
expose
:id
,
:title
,
:key
,
:created_at
end
...
...
lib/api/merge_requests.rb
View file @
94eb5a4c
...
...
@@ -293,7 +293,7 @@ module API
end
desc
'Get the context commits of a merge request'
do
success
Entities
::
Commit
Entity
success
Entities
::
Commit
end
get
':id/merge_requests/:merge_request_iid/context_commits'
do
merge_request
=
find_merge_request_with_access
(
params
[
:merge_request_iid
])
...
...
@@ -301,8 +301,10 @@ module API
not_found!
unless
project
.
context_commits_enabled?
context_commits
=
merge_request
.
context_commits
CommitEntity
.
represent
(
context_commits
,
type: :full
,
request:
merge_request
)
context_commits
=
paginate
(
merge_request
.
merge_request_context_commits
).
map
(
&
:to_commit
)
present
context_commits
,
with:
Entities
::
Commit
end
params
do
...
...
spec/requests/api/merge_requests_spec.rb
View file @
94eb5a4c
...
...
@@ -1069,10 +1069,16 @@ describe API::MergeRequests do
describe
'GET /projects/:id/merge_requests/:merge_request_iid/:context_commits'
do
it
'returns a 200 when merge request is valid'
do
context_commit
=
merge_request
.
context_commits
.
first
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/context_commits"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
(
merge_request
.
context_commits
.
size
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
context_commit
.
id
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
context_commit
.
title
)
end
it
'returns a 404 when merge_request_iid not found'
do
...
...
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