[go: up one dir, main page]

Skip to content

Add line additions/deletions/modifications to repositories contributors API response

Problem to solve

The Repositories API has a contributors endpoint that briefly returned additions and deletions before being changed to always return zero due to technical complexity with Gitaly. Due to that same technical complexity these attributes could not be easily fixed, so they were deprecated and removed under #233119 (closed). However, those attributes may have value for customers.

Proposal

The Repositories API contributors endpoint should return additions and deletions for each contributor, in a way that is performant from Gitaly's perspective.

More sophisticated proposal

Another problem is that additions and deletions (Git's default perspective on line changes) double-count line modifications as 1 addition and 1 deletion. A more intelligent approach is additions, deletions and modifications, because you can distinguish between new work and refactoring. Line modifications can be isolated using git diff --word-diff. See the ~"group::analytics" discovery issue about this. That is a blocker because it needs to be added to Gitaly. Another blocker is performance at scale. It seems the word-diff stats need to be persisted somewhere and queried, because it is not feasible to ask Gitaly to calculate the word-diff for thousands of commits at a time.

Edited by Dan Jensen