Merge request diff doesn't display overflow warning
Summary
Zendesk: https://gitlab.zendesk.com/agent/tickets/126109
Customer noticed a large merge request was only showing 244 changes in the GitLab web UI despite having 409 changes total from the source to target branch. There was no warning banner indicating limits were reached and not all changes were being shown.
The next thing noticed in the web UI is that the 'Changes' tab badge said '244+' indicating it must think more changes exist but it's not showing them. When I dug into code I discovered that the +
does indeed mean that we've hit some limit and we're only showing partial changes. The code for this is at https://gitlab.com/gitlab-org/gitlab-ce/blob/d892e80bf0161b535389c91ccb53539e4f08d790/lib/gitlab/git/diff_collection.rb#L78.
We verified the overflow was occurring by using the Rails console:
merge_request = Project.find(1234).merge_requests.find_by_iid(4567)
merge_request.diff_size
=> "244+" # Same as in the UI
merge_request.merge_request_diff.overflow?
=> true
The UI should display a warning message when an overflow occurs. See https://gitlab.com/gitlab-org/gitlab-ce/blob/d892e80bf0161b535389c91ccb53539e4f08d790/app/views/projects/diffs/_diffs.html.haml#L24. The customer is on 11.8.10, but this code has not changed between 11.8.10 and 12.1. I'm not sure why this overflow message isn't being displayed. I've seen it in the past on merge requests.
Unfortunately we weren't able to determine which limit was getting triggered. As mentioned, the diff has 409 changes, more than 242,000 additions, 2 deletions total. The merge request diff stats say 244+ files changes, 48,261 additions and 2 deletions. I wasn't immediately able to dig far enough in the Rails console to inspect individual limits.
Of interest, if we use the 'Compare' feature to compare the same source and target branch, GitLab shows the entire set of changes (409).
Based on the investigation we can safely say this is not a result of the way GitLab compares branches (as outlined in &854 (closed)).