GitLab presents Project Statistics as thumbnail details on a project page, where in API are these details?

,

See in image, that GitLab displays details such as branches/size/tags/commits.

I’ve been able to find some through API and not others.

size & commit count is available
GET /api/v4/projects/:id?statistics=yes
response:

"statistics": {
 "commit_count": 1234,
 "storage_size": 12346132,
 ...
}

I have found endpoints for Branches and Tags but not for quantities. Or Querying/filtering on branches for stale/merged branches.

Thoughts?

not exactly what I want… however the Header X-Total provides some useful details for aggregate numbers. Still doesn’t allow filtering.

Branch total
GET /projects/:id/repository/branches view X-Total

Tag Total
GET /projects/:id/repository/tags view X-Total

from gitlab-ce

see this code that displays the project stats shown above in the photo. I’m still searching for the controller/service/api that generates the list that is used

# _stats_anchor_list.html.haml
- anchors = local_assigns.fetch(:anchors, [])

- return unless anchors.any?
%ul.nav
  - anchors.each do |anchor|
    %li.nav-item
      = link_to_if anchor.link, anchor.label, anchor.link, class: anchor.is_link ? 'nav-link stat-link d-flex align-items-center' : "nav-link btn btn-#{anchor.class_modifier || 'missing'} d-flex align-items-center" do
        .stat-text.d-flex.align-items-center= anchor.label

Looks like project_presenter.rb constructs the anchor hash that 's consumed by the view?

...
  def statistics_anchors(show_auto_devops_callout:)
    [
      license_anchor_data,
      commits_anchor_data,
      branches_anchor_data,
      tags_anchor_data,
      files_anchor_data
    ].compact.select(&:is_link)
  end
...

Using some git commands I’m able to get similar results for

Number of commits : git rev-list --count origin/master

Branches : git ls-remote --refs --heads | wc -l

Tags: git ls-remote --refs --tag | wc -l

I still have work to complete to be able get the file size.

Also I’m going to look into getting active branches and stale branches and branches which have already been merged.