Add diff count to CommitStats RPC
Background
For commit rapid diffs we need to get a count of all the diff files to populate this badge on the commit page:
Currently to get the count we are querying Gitaly for all diffs.
Separately for rapid diffs we are querying for the first 5 diffs. As per @patrickbajao's comment we could try to use git diff --numstat to return the number of changed files and add this to the CommitStats RPC.
$ git diff --numstat
5 1 app/services/ci/job_artifacts/create_service.rb
22 0 spec/services/ci/job_artifacts/create_service_spec.rb
Proposed solution
A new files property is being added to CommitStats RPC in gitaly!7393 (merged).
From gitlab-rails perspective, we need to:
- Consume the new
filesproperty from RPC response - Use the
Gitlab::Git::Commit#statsin commit page for rapid diffs.
Edited by 🤖 GitLab Bot 🤖
