gitlab api如何获得Last Commit? logs_tree?

时间:2015-05-27 13:03:07

标签: gitlab

gitlab api如何获得最后提交?

GET /projects/:id/repository/tree

{
    "name": "assets",
    "type": "tree",
    "mode": "040000",
    "id": "6229c43a7e16fcc7e95f923f8ddadb8281d9c6c6"
  },?

如何获取logs_tree?最后提交?

2 个答案:

答案 0 :(得分:1)

在当前版本的API中,我们只有一种方法可以解决此问题

GET /api/v4/projects/:id/repository/commits

数组中的第一个提交将是所需的。您可以使用jq'。[0]'

提取它

答案 1 :(得分:0)

我建议您按照列出的here规范说明您可以使用
GET /projects/:id/repository/commits/tree
返回以下示例数据:

{
  "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
  "short_id": "6104942438c",
  "title": "Sanitize for network graph",
  "author_name": "randx",
  "author_email": "dmitriy.zaporozhets@gmail.com",
  "created_at": "2012-09-20T09:06:12+03:00",
  "message": "Sanitize for network graph",
  "committed_date": "2012-09-20T09:06:12+03:00",
  "authored_date": "2012-09-20T09:06:12+03:00",
  "parent_ids": [
    "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
  ],
  "status": "running"
}

这是最新的提交。在查找logs_tree方面,full documentation可能会帮助您