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
Léo-Paul Géneau
gitlab-ce
Commits
a4bb9993
Commit
a4bb9993
authored
Jul 27, 2016
by
dixpac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add commit stats to commit api response
parent
17be364d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
CHANGELOG
CHANGELOG
+1
-0
doc/api/commits.md
doc/api/commits.md
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+5
-0
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+4
-0
No files found.
CHANGELOG
View file @
a4bb9993
...
...
@@ -22,6 +22,7 @@ v 8.11.0 (unreleased)
- Add the `sprockets-es6` gem
- Multiple trigger variables show in separate lines (Katarzyna Kobierska Ula Budziszewska)
- Profile requests when a header is passed
- Add commit stats in commit api. !5517 (dixpac)
- Make error pages responsive (Takuya Noguchi)
- Change requests_profiles resource constraint to catch virtually any file
...
...
doc/api/commits.md
View file @
a4bb9993
...
...
@@ -81,6 +81,11 @@ Example response:
"parent_ids"
:
[
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"stats"
:
{
"additions"
:
15
,
"deletions"
:
10
,
"total"
:
25
},
"status"
:
"running"
}
```
...
...
lib/api/entities.rb
View file @
a4bb9993
...
...
@@ -149,8 +149,13 @@ module API
expose
:safe_message
,
as: :message
end
class
RepoCommitStats
<
Grape
::
Entity
expose
:additions
,
:deletions
,
:total
end
class
RepoCommitDetail
<
RepoCommit
expose
:parent_ids
,
:committed_date
,
:authored_date
expose
:stats
,
using:
Entities
::
RepoCommitStats
expose
:status
end
...
...
spec/requests/api/commits_spec.rb
View file @
a4bb9993
...
...
@@ -73,9 +73,13 @@ describe API::API, api: true do
context
"authorized user"
do
it
"should return a commit by sha"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'id'
]).
to
eq
(
project
.
repository
.
commit
.
id
)
expect
(
json_response
[
'title'
]).
to
eq
(
project
.
repository
.
commit
.
title
)
expect
(
json_response
[
'stats'
][
'additions'
]).
to
eq
(
project
.
repository
.
commit
.
stats
.
additions
)
expect
(
json_response
[
'stats'
][
'deletions'
]).
to
eq
(
project
.
repository
.
commit
.
stats
.
deletions
)
expect
(
json_response
[
'stats'
][
'total'
]).
to
eq
(
project
.
repository
.
commit
.
stats
.
total
)
end
it
"should return a 404 error if 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