获取比较提交的diff信息
GET
/api/v1/{owner}/{repo}/compare.json最后修改时间: 1 年前
请求参数
Path 参数
owner
string
项目拥有者用户标识
repo
string
项目标识
Query 参数
from
string
必需
源分支、标签、提交标识
to
string
必需
目标分支、标签、提交标识
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
commits_count
integer
提交数量
last_commit_sha
null
必需
commits
array [object {6}]
必需
author
object
提交作者
committer
object
提交者
branch
null
提交分支
commit_message
string
提交信息
sha
string
提交标识
parent_shas
null
提交信息标识
diff
object
必需
file_nums
integer
文件数量
total_addition
integer
新增行数
total_deletion
integer
删除行数
files
array [object {17}]
必需
示例
{
"commits_count": 1,
"last_commit_sha": null,
"commits": [
{
"author": {
"id": "110",
"login": "yystopf",
"name": "咸蛋黄土豆丝xxx",
"type": "User",
"image_url": "system/lets/letter_avatars/2/X/230_139_26/120.png"
},
"committer": {
"id": "110",
"login": "yystopf",
"name": "咸蛋黄土豆丝xxx",
"type": "User",
"image_url": "system/lets/letter_avatars/2/X/230_139_26/120.png"
},
"branch": null,
"commit_message": "测试提交\n",
"sha": "88801266695966b11fcd95ba2bcefad56750d1d9",
"parent_shas": null
}
],
"diff": {
"file_nums": 1,
"total_addition": 1,
"total_deletion": 0,
"files": [
{
"name": "heihei7",
"oldname": "heihei7",
"addition": 1,
"deletion": 0,
"type": 1,
"is_created": true,
"is_deleted": false,
"is_bin": false,
"is_lfs_file": false,
"is_renamed": false,
"is_ambiguous": false,
"is_submodule": false,
"diff": null,
"sections": [
{
"file_name": "heihei7",
"name": "",
"lines": [
{
"left_index": 0,
"right_index": 0,
"match": 0,
"type": 4,
"content": "@@ -0,0 +1 @@",
"section_path": "heihei7",
"section_last_left_index": 0,
"section_last_right_index": 0,
"section_left_index": 0,
"section_right_index": 1,
"section_left_hunk_size": 0,
"section_right_hunk_size": 0
},
{
"left_index": 0,
"right_index": 1,
"match": -1,
"type": 2,
"content": "+jfksj"
}
]
}
],
"is_incomplete": false,
"is_incomplete_line_too_long": false,
"is_protected": false
}
]
}
}
最后修改时间: 1 年前