Support follow parameter with keyset pagination in Commits API (requires Gitaly change)
Summary
Enable the follow parameter to work with keyset pagination (pagination=keyset) in the Commits API.
Parent Issue
This is part of #595504 (closed) (Epic: Refactor Commits API to use standard keyset pagination patterns)
Background
Unlike path, first_parent, and order, the follow parameter is genuinely not supported by Gitaly's ListCommits RPC.
This is a follow-up issue that requires Gitaly changes.
What follow Does
The follow parameter corresponds to Git's --follow flag, which continues listing the history of a file beyond renames. This is useful for tracking a file's full history even when it has been moved or renamed.
Problem
Users wanting to follow file renames in commit history must use offset pagination.
Solution
This requires a two-phase approach:
Phase 1: Gitaly Change
Add follow support to ListCommits RPC:
message ListCommitsRequest {
// ...
bool follow = XX; // New field - enables --follow for path filtering
}Note: follow only makes sense when paths is also specified.
Phase 2: Rails Change
Pass follow parameter through to list_commits.
Acceptance Criteria
- Gitaly issue created for
ListCommitsfollow support - Gitaly MR merged
- Rails code updated to pass
followparameter - Tests added (including rename scenarios)
Effort Estimate
Unsure. This is going to take collaboration with the Gitaly team to get follow support in ListCommits
References
- Parent epic: #595504 (closed)
- Gitaly repo: https://gitlab.com/gitlab-org/gitaly
- Git documentation:
git log --follow - Depends on: Gitaly proto change
- Prior art (Rails pattern for
path): !243938 (merged) - Sibling Gitaly-dependent issue (consider batching proto changes): #595516 (closed)