Skip DiffStats calls in Rapid Diffs

What does this MR do and why?

Related: #588880

This MR skips DiffStats RPC call to Gitaly in Rapid Diffs when 'Show whitespace changes' setting is enabled.

We can do so because DiffStats call is used to:

  1. Determine if we have any more diffs to stream through the streaming endpoint
  2. Provide stat counters for diff files because diffs without whitespace changes have different counters

When we show diffs with whitespace changes this is no longer necessary because:

  1. We can determine if we need to stream the rest of the diffs based on overflow_marker from CommitDiff RPC, that tells us if there are more diffs to show after the first five
  2. We don't need to detect whitespace-only collapsed diffs or provide diff stats since we include whitespace changes and the stats will be correct, as well as all files will be present

Screenshots or screen recordings

Before After
image image

How to set up and validate locally

  1. Enable rapid_diffs_on_commit_show feature flag
  2. Go to any large commit
  3. Enable 'Show whitespace changes' setting in view settings
  4. Reload the page
  5. Observe no DiffStats call in performance bar

Merge request reports

Loading