Commits

Nick Kallen edited this page Aug 22, 2013 · 1 revision
Clone this wiki locally

Get a commit

GET /repos/:repo/commits/:sha
Response
{
  "sha": "a3ba5a6e314ed63571e01677463164cb7a8a1e9b",
  "message": "Urls provided in json\n",
  "author": {
    "date": "2013-08-20T14:07:42.000Z",
    "name": "Nick Kallen",
    "email": "socialmediamaster9000@gmail.com"
  },
  "committer": {
    "date": "2013-08-20T14:07:42.000Z",
    "name": "Nick Kallen",
    "email": "socialmediamaster9000@gmail.com"
  },
  "tree": {
    "sha": "73720a4c31acc9563d65483614b46901315646c1"
  },
  "parents": [
    {
      "sha": "47c45a658a6a6ff3a3d6b78cd30d8dc05eb49045",
      "url": "/repos/gitdb/commits/47c45a658a6a6ff3a3d6b78cd30d8dc05eb49045"
    }
  ],
  "url": "/repos/gitdb/commits/a3ba5a6e314ed63571e01677463164cb7a8a1e9b",
  "tree_url": "/repos/gitdb/commits/a3ba5a6e314ed63571e01677463164cb7a8a1e9b/tree/",
  "repo": {
    "url": "/repos/gitdb",
    "refs_url": "/repos/gitdb/refs"
  }
}

Get a tree, relative to a commit

A tree represents the state of the file system. A given element in the tree might be a tree itself (i.e., a directory) or a blob (i.e., a file in a directory) -- the response look different for these different types.

GET /repos/:repo/commits/tree/:sha/*
Response for a tree
{
  "name": "",
  "path": "",
  "type": "tree",
  "filemode": 16384,
  "commit_relative_url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7/tree/",
  "url": "/repos/gitdb/trees/93fb384f1f8bfac23a2fbef7f4c40a345a0fd312/",
  "tree": {
    "sha": "93fb384f1f8bfac23a2fbef7f4c40a345a0fd312",
    "url": "/repos/gitdb/trees/93fb384f1f8bfac23a2fbef7f4c40a345a0fd312/",
    "entries": [
      {
        "name": ".gitignore",
        "path": ".gitignore",
        "type": "blob",
        "filemode": 33188,
        "commit_relative_url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7/tree/.gitignore",
        "url": "/repos/gitdb/blobs/3a1651fa759ca2e1717993b8bb75f951a732ee43"
      },
      {
        "name": "README.md",
        "path": "README.md",
        "type": "blob",
        "filemode": 33188,
        "commit_relative_url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7/tree/README.md",
        "url": "/repos/gitdb/blobs/5c5ac45d9513562cc96e8e7021a8064009451ed8"
      }
    ]
  },
  "commit": {
    "sha": "38f8d228f43f53bc42a77d5821aece4f09e66ca7",
    "message": "Better web navigation\n",
    "author": {
      "date": "2013-08-20T15:54:42.000Z",
      "name": "Nick Kallen",
      "email": "socialmediamaster9000@gmail.com"
    },
    "committer": {
      "date": "2013-08-20T15:54:42.000Z",
      "name": "Nick Kallen",
      "email": "socialmediamaster9000@gmail.com"
    },
    "tree": {
      "sha": "93fb384f1f8bfac23a2fbef7f4c40a345a0fd312"
    },
    "parents": [
      {
        "sha": "a3ba5a6e314ed63571e01677463164cb7a8a1e9b",
        "url": "/repos/gitdb/commits/a3ba5a6e314ed63571e01677463164cb7a8a1e9b"
      }
    ],
    "url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7",
    "tree_url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7/tree/",
    "repo": {
      "url": "/repos/gitdb",
      "refs_url": "/repos/gitdb/refs"
    }
  },
  "repo": {
    "url": "/repos/gitdb",
    "refs_url": "/repos/gitdb/refs"
  }
}
Response for a blob
{
  "name": "README.md",
  "path": "README.md",
  "type": "blob",
  "filemode": 33188,
  "commit_relative_url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7/tree/README.md",
  "url": "/repos/gitdb/blobs/5c5ac45d9513562cc96e8e7021a8064009451ed8",
  "blob": {
    "filemode": 33188,
    "encoding": "base64",
    "size": 1276,
    "content": "KipHaXREQioqI...",
    "sha": "5c5ac45d9513562cc96e8e7021a8064009451ed8",
    "url": "/repos/gitdb/blobs/5c5ac45d9513562cc96e8e7021a8064009451ed8"
  },
  "commit": {
    "sha": "38f8d228f43f53bc42a77d5821aece4f09e66ca7",
    "message": "Better web navigation\n",
    "author": {
      "date": "2013-08-20T15:54:42.000Z",
      "name": "Nick Kallen",
      "email": "socialmediamaster9000@gmail.com"
    },
    "committer": {
      "date": "2013-08-20T15:54:42.000Z",
      "name": "Nick Kallen",
      "email": "socialmediamaster9000@gmail.com"
    },
    "tree": {
      "sha": "93fb384f1f8bfac23a2fbef7f4c40a345a0fd312"
    },
    "parents": [
      {
        "sha": "a3ba5a6e314ed63571e01677463164cb7a8a1e9b",
        "url": "/repos/gitdb/commits/a3ba5a6e314ed63571e01677463164cb7a8a1e9b"
      }
    ],
    "url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7",
    "tree_url": "/repos/gitdb/commits/38f8d228f43f53bc42a77d5821aece4f09e66ca7/tree/",
    "repo": {
      "url": "/repos/gitdb",
      "refs_url": "/repos/gitdb/refs"
    }
  },
  "repo": {
    "url": "/repos/gitdb",
    "refs_url": "/repos/gitdb/refs"
  }
}