# CodeDiffFile

One changed file in a diff.

**Kind:** an object, used in responses.

## Fields

Every field is present in a response; empty ones are `null`.

| Field | Type | Description |
|---|---|---|
| `fileModeOld` | `string \| null` | The file's old mode (for example `100644`), when it was deleted or its mode changed. |
| `fileModeNew` | `string \| null` | The file's new mode (for example `100755`), when it is new or its mode changed. |
| `pathOld` | `string \| null` | The path the file was renamed or copied from. |
| `pathNew` | `string \| null` | The path the file was renamed or copied to. |
| `isRenamed` | `boolean` | Whether the file was renamed. |
| `isDeleted` | `boolean` | Whether the file was deleted. |
| `isNew` | `boolean` | Whether the file is new. |
| `isCopied` | `boolean` | Whether the file was copied from another. |
| `similarityIndex` | `number \| null` | For a rename or copy, how similar the two files are, as a percentage. |
| `dissimilarityIndex` | `number \| null` | For a rewritten file, how different the old and new contents are, as a percentage. |
| `hashOld` | `string \| null` | The git object id (abbreviated) of the file's old contents. |
| `hashNew` | `string \| null` | The git object id (abbreviated) of the file's new contents. |
| `filename` | `string \| null` | The file's path within its repository. |
| `changes` | [`CodeDiffChange`](https://docs.maitento.com/reference/types/code-diff-change.md)`[]` | The changed sections of the file. Empty for a binary file. |
| `isBinary` | `boolean` | Whether the file is binary, so no line changes are given. |
| `repositoryName` | `string \| null` | The `name` of the run repository the file is in. |

## Example

```json
{
  "fileModeOld": "...",
  "fileModeNew": "...",
  "pathOld": "...",
  "pathNew": "...",
  "isRenamed": false,
  "isDeleted": false,
  "isNew": false,
  "isCopied": false,
  "similarityIndex": 0,
  "dissimilarityIndex": 0,
  "hashOld": "...",
  "hashNew": "...",
  "filename": "...",
  "changes": [
    {
      "diff": [],
      "header": "..."
    }
  ],
  "isBinary": false,
  "repositoryName": "..."
}
```

## Where it's used

- Inside [`CodeDiff`](https://docs.maitento.com/reference/types/code-diff.md)
