Commit 1c0929f5acbabcd7ebb0f95e4da2a4e18713e7e2
Exists in
spb-stable
and in
3 other branches
Merge pull request #5823 from bobot/feature/api_parent_ids
[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 | 259 | "title": "Sanitize for network graph", |
| 260 | 260 | "author_name": "randx", |
| 261 | 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 | 91 | expose :id, :short_id, :title, :author_name, :author_email, :created_at |
| 92 | 92 | end |
| 93 | 93 | |
| 94 | + class RepoCommitDetail < RepoCommit | |
| 95 | + expose :parent_ids, :committed_date, :authored_date | |
| 96 | + end | |
| 97 | + | |
| 94 | 98 | class ProjectSnippet < Grape::Entity |
| 95 | 99 | expose :id, :title, :file_name |
| 96 | 100 | expose :author, using: Entities::UserBasic | ... | ... |
lib/api/repositories.rb
| ... | ... | @@ -112,7 +112,7 @@ module API |
| 112 | 112 | sha = params[:sha] |
| 113 | 113 | commit = user_project.repository.commit(sha) |
| 114 | 114 | not_found! "Commit" unless commit |
| 115 | - present commit, with: Entities::RepoCommit | |
| 115 | + present commit, with: Entities::RepoCommitDetail | |
| 116 | 116 | end |
| 117 | 117 | |
| 118 | 118 | # Get the diff for a specific commit of a project | ... | ... |