Skip to content

Add option to disable commit stats to commit API

Calculating stats for large commits can be very slow and cause API requests to time out. There is an issue in libgit2 that has been fixed but not yet released that can exacerbate this too.

Depending on the reason for the API request this data may not be needed. We should provide an option to exclude this expensive information if it is not required.

  ...
  "stats": {
    "additions": 15,
    "deletions": 10,
    "total": 25
  },
  ...

Proposal

Add stats=false option to the API resources that return stats to skip calculating stats and exclude stats object from the response.

Default behavior will continue to be to include commit stats.

Links / references

Edited by James Ramsay (ex-GitLab)