Commit Diff API returns incomplete results for large commits

Summary

Commit Diff API does not return all the changes for large commits.

Steps to reproduce

  1. Check that 5580 files have been added in the commit af79cb1c
  2. Check the HTTP Response Headers (X-Total and X-Total-Pages) for https://gitlab.com/api/v4/projects/48897291/repository/commits/af79cb1c7ceebdf2a392a166cded40b25c69495e/diff?per_page=100&page=1

Example Project

Example project -> /diffapitestgroup/diffapitest

What is the current bug behavior?

For per_page = 100,
X-Total = 1215 (shows that only 1215 files were changed in this commit)
X-Total-Pages = 13 (shows that pagination can be done to fetch data till only 13 pages)

What is the expected correct behavior?

For per_page = 100,
X-Total = 5580
X-Total-Pages = 56

Relevant screenshots

image image

Output of checks

This bug happens on GitLab.com