Add whitespace_only flag to CommitDiff RPC
Right now GitLab uses DiffStats RPC to determine if a particular diff file contains only whitespace changes. This is possible because of the following:
- Whitespace only diff files are sent with empty patch data from Gitaly
-
DiffStatsRPC contains the actual line count of the diff
By comparing these two data points we can infer that the diff was indeed collapsed due to whitespace changes.
However this is very inefficient because:
- Gitaly already does the heavy-lifting for detecting such files
- Sending additional
DiffStatsRPC is expensive
To solve this problem we could have a whitespace_only flag added to CommitDiffResponse.