Gitaly: Add batch version of CommitStats RPC
Problem
I'm working on a service that sends branch data to Jira (gitlab#263240 (closed)). Currently, we sync branch data only on events, like when a new branch is created. But we also want to be able to sync multiple branches in one go when a new Project gets connected to Jira.
The data includes the number of files that were changed. We currently use the CommitStats RPC but we ran into an N+1 problem because it is not possible to batch load stats for multiple commits. I tried it in this MR: gitlab!48706 (comment 459086632).
Possible solutions
Create a batch version of the CommitStats RPC