Skip to content

Dangling commits missing from commits API response when all=true

Example code available at https://github.com/RichardoC/gitlab-secrets

Expected behaviour

GET /api/v4/projects/{repo_id}/repository/commits?all=true would return every commit, even if it's dangling (so is not referenced on any branch)

Actual behaviour

Only commits that are referenced by branches are returned.

The dangling commits still exist, and can be discovered by checking all events on that repository to find commits that were not referenced in that API response.

https://gitlab.com/gitlab-secrets/gitlab-secrets can be used to check this behaviour, there's only 1 "official" commit, but there are 4 total commits.