I’m trying to find a way to reproduce how the Gitlab API arrives at the “commit_count” value as provided by the api/v4/projects?statistics=true endpoint.
I would expect something like this would give the same value (performed on the same, up-to-date, local repository):
git rev-list --count --all
But it does not, often off by a few commits.
Can anyone shine a light on how “commit_count” is populated?
I think you are assuming this, understandably. But the count of --all comes much closer than the count of a specific (the default or any other) branch. So I think commit_count is meant to be all the commits across all branches. So my original question still stands.
I tested this on Gitlab 9.5.2 docker image.
The commit_count is the value stored in the projects table column commit_count and also the commit count that is shown on the gitlab web page of a project.
I just pushed to the master branch and was getting the right values but when I created a different branch and pushed to it and saw the value didn’t increase and the value from the api call was the same.