morgant
morgant

Reputation: 2225

What are the status types for files in the GitHub API v3?

Okay, I'm porting some code that used the GitHub API v2 to v3 and they've changed the way they list files in commits. There's now an array of files, each of which has a status, as opposed to arrays of 'added', 'modified', and 'removed' files like in v2.

Easy, but their examples only show statuses of 'added' & 'modified' and not removed/deleted. I'd assume that it'd be 'removed' like v2, but 'deleted' would be the correct git terminology so I don't want to just assume. The repo I am testing on happens to not have any deleted files, so I have no examples at the moment.

So, which is it 'removed' or 'deleted' in GitHub API v3?

Upvotes: 3

Views: 984

Answers (2)

Chuanqi Sun
Chuanqi Sun

Reputation: 1382

The official status is listed in the JSON Schema in the Commits API

{
  "status": {
    "type": "string",
    "enum": [
      "added",
      "removed",
      "modified",
      "renamed",
      "copied",
      "changed",
      "unchanged"
    ],
    "examples": [
      "added"
    ]
  }
}

Tip: the schema is inside the tab next to the examples enter image description here

Upvotes: 2

morgant
morgant

Reputation: 2225

It is 'removed'. I finally found a commit in one of my repositories where I actually deleted a file and confirmed.

Upvotes: 1

Related Questions