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
Boxiang Sun
gitlab-ce
Commits
79d99d47
Commit
79d99d47
authored
Nov 30, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Expose committer details for a commit
parent
c2be86b5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
2 deletions
+20
-2
changelogs/unreleased/api-expose-commiter-details.yml
changelogs/unreleased/api-expose-commiter-details.yml
+4
-0
doc/api/commits.md
doc/api/commits.md
+8
-0
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+7
-2
No files found.
changelogs/unreleased/api-expose-commiter-details.yml
0 → 100644
View file @
79d99d47
---
title
:
'
API:
Expose
committer
details
for
commits'
merge_request
:
author
:
Robert Schilling
doc/api/commits.md
View file @
79d99d47
...
...
@@ -29,6 +29,8 @@ Example response:
"title"
:
"Replace sanitize with escape once"
,
"author_name"
:
"Dmitriy Zaporozhets"
,
"author_email"
:
"dzaporozhets@sphereconsultinginc.com"
,
"committer_name"
:
"Administrator"
,
"committer_email"
:
"admin@example.com"
,
"created_at"
:
"2012-09-20T11:50:22+03:00"
,
"message"
:
"Replace sanitize with escape once"
,
"allow_failure"
:
false
...
...
@@ -39,6 +41,8 @@ Example response:
"title"
:
"Sanitize for network graph"
,
"author_name"
:
"randx"
,
"author_email"
:
"dmitriy.zaporozhets@gmail.com"
,
"committer_name"
:
"Dmitriy"
,
"committer_email"
:
"dmitriy.zaporozhets@gmail.com"
,
"created_at"
:
"2012-09-20T09:06:12+03:00"
,
"message"
:
"Sanitize for network graph"
,
"allow_failure"
:
false
...
...
@@ -115,6 +119,8 @@ Example response:
"title"
:
"some commit message"
,
"author_name"
:
"Dmitriy Zaporozhets"
,
"author_email"
:
"dzaporozhets@sphereconsultinginc.com"
,
"committer_name"
:
"Dmitriy Zaporozhets"
,
"committer_email"
:
"dzaporozhets@sphereconsultinginc.com"
,
"created_at"
:
"2016-09-20T09:26:24.000-07:00"
,
"message"
:
"some commit message"
,
"parent_ids"
:
[
...
...
@@ -159,6 +165,8 @@ Example response:
"title"
:
"Sanitize for network graph"
,
"author_name"
:
"randx"
,
"author_email"
:
"dmitriy.zaporozhets@gmail.com"
,
"committer_name"
:
"Dmitriy"
,
"committer_email"
:
"dmitriy.zaporozhets@gmail.com"
,
"created_at"
:
"2012-09-20T09:06:12+03:00"
,
"message"
:
"Sanitize for network graph"
,
"committed_date"
:
"2012-09-20T09:06:12+03:00"
,
...
...
lib/api/entities.rb
View file @
79d99d47
...
...
@@ -174,6 +174,7 @@ module API
class
RepoCommit
<
Grape
::
Entity
expose
:id
,
:short_id
,
:title
,
:author_name
,
:author_email
,
:created_at
expose
:committer_name
,
:committer_email
expose
:safe_message
,
as: :message
end
...
...
spec/requests/api/commits_spec.rb
View file @
79d99d47
...
...
@@ -18,11 +18,14 @@ describe API::API, api: true do
before
{
project
.
team
<<
[
user2
,
:reporter
]
}
it
"returns project commits"
do
commit
=
project
.
repository
.
commit
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
project
.
repository
.
commit
.
id
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
commit
.
id
)
expect
(
json_response
.
first
[
'committer_name'
]).
to
eq
(
commit
.
committer_name
)
expect
(
json_response
.
first
[
'committer_email'
]).
to
eq
(
commit
.
committer_email
)
end
end
...
...
@@ -134,6 +137,8 @@ describe API::API, api: true do
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
message
)
expect
(
json_response
[
'committer_name'
]).
to
eq
(
user
.
name
)
expect
(
json_response
[
'committer_email'
]).
to
eq
(
user
.
email
)
end
it
'returns a 400 bad request if file exists'
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