Commit 7b3b63d4d49dd5c3876e2f0c02026dd9cb289f32
1 parent
880fef0d
Exists in
spb-stable
and in
3 other branches
[API] add parent_ids to specific commit informations
Showing
3 changed files
with
11 additions
and
2 deletions
Show diff stats
doc/api/repositories.md
@@ -259,7 +259,12 @@ Parameters: | @@ -259,7 +259,12 @@ Parameters: | ||
259 | "title": "Sanitize for network graph", | 259 | "title": "Sanitize for network graph", |
260 | "author_name": "randx", | 260 | "author_name": "randx", |
261 | "author_email": "dmitriy.zaporozhets@gmail.com", | 261 | "author_email": "dmitriy.zaporozhets@gmail.com", |
262 | - "created_at": "2012-09-20T09:06:12+03:00" | 262 | + "created_at": "2012-09-20T09:06:12+03:00", |
263 | + "committed_date": "2012-09-20T09:06:12+03:00", | ||
264 | + "authored_date": "2012-09-20T09:06:12+03:00", | ||
265 | + "parent_ids" : [ | ||
266 | + "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" | ||
267 | + ] | ||
263 | } | 268 | } |
264 | ``` | 269 | ``` |
265 | 270 |
lib/api/entities.rb
@@ -91,6 +91,10 @@ module API | @@ -91,6 +91,10 @@ module API | ||
91 | expose :id, :short_id, :title, :author_name, :author_email, :created_at | 91 | expose :id, :short_id, :title, :author_name, :author_email, :created_at |
92 | end | 92 | end |
93 | 93 | ||
94 | + class RepoCommitDetail < RepoCommit | ||
95 | + expose :parent_ids, :committed_date, :authored_date | ||
96 | + end | ||
97 | + | ||
94 | class ProjectSnippet < Grape::Entity | 98 | class ProjectSnippet < Grape::Entity |
95 | expose :id, :title, :file_name | 99 | expose :id, :title, :file_name |
96 | expose :author, using: Entities::UserBasic | 100 | expose :author, using: Entities::UserBasic |
lib/api/repositories.rb
@@ -110,7 +110,7 @@ module API | @@ -110,7 +110,7 @@ module API | ||
110 | sha = params[:sha] | 110 | sha = params[:sha] |
111 | commit = user_project.repository.commit(sha) | 111 | commit = user_project.repository.commit(sha) |
112 | not_found! "Commit" unless commit | 112 | not_found! "Commit" unless commit |
113 | - present commit, with: Entities::RepoCommit | 113 | + present commit, with: Entities::RepoCommitDetail |
114 | end | 114 | end |
115 | 115 | ||
116 | # Get the diff for a specific commit of a project | 116 | # Get the diff for a specific commit of a project |