Skip to content

Add support for a path argument to ListCommits RPC to allow filtering for a specific file's history

Issue

We need to be able to support viewing a specific file or directory's commit history through the ListCommits RPC.

Proposal

Add a new argument to the ListCommitsRequest to pass a path and then use this to filter the returned commits.

Context

Source Code is currently implementing changes to the commits page.

While investigating the existing logic we found that the code uses the CommitsByMessage RPC if a search term is passed, or the FindCommits if no search term is passed. This means the current UI cannot filter by search term and any other filter at the same time.

To fix this we originally thought we would update the FindCommits RPC to accept a search query argument which did actually happen Add support for a query param to gitaly's `Find... (gitlab#542319 - closed).

We then began looking at supporting cursor based pagination with the FindCommits RPC as [the GitLab GraphQL API uses cursors for pagination]. While looking around the code we found a deprecation notice in the ListCommits RPC which states:

  // This deprecates FindAllCommits and FindCommits (except Follow is not yet supported).
  rpc ListCommits(ListCommitsRequest) returns (stream ListCommitsResponse) {

We confirmed this with gitaly and began using the ListCommits RPC but have noticed the RPC currently does not support filtering by a path so would like to add support for it if possible.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information