Api to get total commits count

We need function of git command line

git rev-list --count --first-parent <commit sha>

to get sequence number of given commit
I tried with list-commit api with param

commits?first_parent=true&ref_name='<commit sha>'

by counting all commits, I can mimic git command line. however it is obviously very stressful.

and gitlab api won’t return ‘x-total’ when commits count are high enough.

Is there anyway to achieve this feature?

if not please consider this as feature request

I can think a few ways

  1. as dedicate api
  2. add count-only flag on list-commits api
  3. add force-total-count generic pagination flag to force return x-total header