Follow file renames on the commits page (ListCommits.follow)
What does this MR do and why?
The commits page (the web UI file-history view) stopped following file renames. When you open a file's history, the list dead-ends at the commit that renamed the file. Older commits under the previous name are missing and "Next" is disabled. This regressed when project_commits_refactor moved the page from the REST/FindCommits path to a GraphQL query resolved by Resolvers::Repositories::CommitsResolver, which calls Repository#list_commits → Gitaly's ListCommits RPC.
gitaly!9086 (merged) (merged, 19.4) added --follow support for ListCommits. This MR wires that field through the Rails app and turns it on only for the safe single-path file-history case.
How
The follow flag is threaded down the existing call chain and opted in only where it is valid:
CommitService#list_commitssetsrequest.follow = trueonly whenparams[:follow]is truthyGitlab::Git::Repository#list_commitsandRepository#list_commitsgain afollow:kwarg (defaultfalse) forwarded down the chain.reverse:stays hardcoded tofalse, andskipis not used on this path. This is required becausegitaly!9086rejectsfollowcombined withreverse, multiple paths, orskip.CommitsResolversetsfollow: trueonly when a (single, scalar) path is present, the new flag is enabled for the project, and theremove_file_commit_history_followingops flag is off.
Behavior is gated behind a new list_commits_follow feature flag (gitlab_com_derisk, default_enabled: false, milestone 19.5).
Before merging
- Swap to
~> 19.4.0and re-syncGemfile.lock/Gemfile.next.lockbefore merge.
Related
- Bug: #628900 (closed)
- Gitaly: gitaly!9086 (merged) (adds
ListCommits.follow) - Completes the Rails half of #595517 (closed) (page path); REST keyset
followremains a separate, larger follow-up (reverse/order contract). - Complementary to the
project_commits_refactorstable-branch backport for 19.1–19.4.
MR checklist
- Swap gitaly gem RC →
~> 19.4.0final and re-sync lockfiles - Create rollout issue and set
rollout_issue_urlin the flag YAML - Set
introduced_by_urlto this MR's URL - Apply feature flag + source-code labels
- Request Source Code Backend domain review