Skip to content

[Schema Inaccuracy] diff-entry returns null on commit SHA when the file permission was changed #4652

Open
@jayjoshi64

Description

@jayjoshi64

Schema Inaccuracy

When checking the diff between 2 commits using diff-entry, if any commit contains a file with permission changes, the endpoint return None as files[].sha. which is unexpected according to the schema.

While None makes sense, the schema should be reflected to handle this scenario.

Example

{"url": "str",
 "html_url": "str",
 "permalink_url": "str",
 "diff_url": "str",
 "patch_url": "str",
 "base_commit": { . . . base commit details . . .},
 "merge_base_commit": {. . . merge base details },
 "status": "ahead",
 "ahead_by": 1,
 "behind_by": 0,
 "total_commits": 1,
 "commits": [. . . commit details ],
 "files": [
  {
    "sha": null,                    <--- Problem, schema mentions str 
    "filename": "test_file.py",
    "status": "modified",
    "additions": 0,                 <---- literal 0 
    "deletions": 0,                 <---- literal 0
    "changes": 0,                   <---- literal 0
    "blob_url": "str",
    "raw_url": "str",
    "contents_url": "str",
    "patch": "str"
   }
  ]
}

Reproduction Steps

  1. Create a commit containing only permission changes, nothing else.
  2. Try to get the commit using the diff-entry endpoint.
  3. Check that the files endpoint will have sha: None.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions