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_commits sets request.follow = true only when params[:follow] is truthy
  • Gitlab::Git::Repository#list_commits and Repository#list_commits gain a follow: kwarg (default false) forwarded down the chain. reverse: stays hardcoded to false, and skip is not used on this path. This is required because gitaly!9086 rejects follow combined with reverse, multiple paths, or skip.
  • CommitsResolver sets follow: true only when a (single, scalar) path is present, the new flag is enabled for the project, and the remove_file_commit_history_following ops 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.0 and re-sync Gemfile.lock / Gemfile.next.lock before merge.
  • Bug: #628900 (closed)
  • Gitaly: gitaly!9086 (merged) (adds ListCommits.follow)
  • Completes the Rails half of #595517 (closed) (page path); REST keyset follow remains a separate, larger follow-up (reverse/order contract).
  • Complementary to the project_commits_refactor stable-branch backport for 19.1–19.4.

MR checklist

  • Swap gitaly gem RC → ~> 19.4.0 final and re-sync lockfiles
  • Create rollout issue and set rollout_issue_url in the flag YAML
  • Set introduced_by_url to this MR's URL
  • Apply feature flag + source-code labels
  • Request Source Code Backend domain review
Edited by Hunter Stewart

Merge request reports

Loading
Loading