Add changed paths endpoint

Summary

Adds a changed paths endpoint to the Repositories API, behind a feature flag.

Closes #599029 (closed)

What does this MR do?

  • Adds GET /projects/:id/repository/changed_paths, which lists every path that differs between two refs along with its change status and file modes, with rename detection available through a find_renames parameter, and paginated results.
  • Calls the Gitaly FindChangedPaths RPC through Gitlab::Git::DiffTree, passing the refs directly so a single Gitaly call resolves and diffs them.
  • Gated behind the off by default beta feature flag repository_changed_paths_api, with route_setting :lifecycle, :beta. Rollout issue: #605935
  • Authorized through the read_repository_comparison project permission.
  • Returns 404 only when ref resolution fails. A saturated or slow Gitaly raises ResourceExhaustedError or CommandTimedOut, which propagate instead of being reported as a missing ref.
  • Adds request specs, a doc/api/repositories.md section, and regenerated OpenAPI and granular token permission documentation.

No changelog entry, since the feature flag is off by default.

Part of the epic gitlab-org#21900

Edited by Mustafa Bayar

Merge request reports

Loading
Loading