ADD get commit diff api

This commit is contained in:
Jasder
2020-05-29 15:33:17 +08:00
parent b266085e56
commit 79a97b4a02
8 changed files with 75 additions and 16 deletions

View File

@@ -0,0 +1,8 @@
if user
json.id user.id
json.login user.login
json.name user.real_name
json.image_url url_to_avatar(user)
else
json.nil!
end

View File

@@ -0,0 +1,26 @@
json.key_format! camelize: :lower
json.additions @custom_commit['TotalAddition']
json.deletions @custom_commit['TotalDeletion']
json.sha @commit['sha']
json.url request.url
json.commit do
@commit['commit'].delete('url')
json.author @commit['commit']['author']
json.committer @commit['commit']['committer']
json.tree do
@commit['commit']['tree']['sha']
end
end
json.author do
json.partial! 'commit_author', user: render_commit_author(@commit['author'])
end
json.committer do
json.partial! 'commit_author', user: render_commit_author(@commit['committer'])
end
json.parents @commit['parents'] do |parent|
json.sha parent['sha']
json.url EduSetting.get('host_name') + commit_repository_path(@repo, parent['sha'])
end
json.files @custom_commit['Files']