Integrate Gitaly CountCommits pseudo-revisions support in Rails application

Summary

Gitaly's CountCommits RPC now supports pseudo-revisions like --branches, --tags, --not, --all, and --glob through a new revisions field. This brings CountCommits in line with ListCommits functionality.

Related Gitaly MR: gitaly!8349 (merged)

Changes in Gitaly

The Gitaly CountCommits RPC has been extended with:

  • A new repeated bytes revisions field in CountCommitsRequest
  • Support for pseudo-revisions using AllowPseudoRevision() validation
  • Backward compatibility with existing revision and all fields
  • The new revisions field takes precedence when provided

Example usage:

  • Count commits in all branches: revisions=["--branches"]
  • Count commits excluding a ref: revisions=["HEAD", "--not", "main"]

Integration Tasks

  • Update Gitaly protobuf definitions to include the new revisions field
  • Identify places in Rails codebase where CountCommits is called
  • Update Gitlab::Git::Repository to expose the new revisions parameter
  • Add support for passing multiple revisions and pseudo-revisions
  • Update relevant GraphQL or REST API endpoints
  • Add tests for the new functionality

Benefits

  • More efficient commit counting across multiple refs
  • Support for complex revision queries
  • Consistency with ListCommits API patterns
  • Better performance for multi-reference operations
Edited Jan 19, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading