Display `parent_ids` in merge request commits API response

What does this MR do and why?

Contributes to #496665 (closed)

Problem

Merge request commits are stored in the database without information about their parent_ids. As a result, commits created from DB records are missing this data.

Solution

Load commit content from Gitaly to have access to full commit information.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2025-02-14_at_15.08.43 Screenshot_2025-02-14_at_15.08.58

How to set up and validate locally

  1. Enable feature flag

    Feature.enable(:commits_from_gitaly)
  2. Visit merge request commits API endpoint (http://gdk.test:3000/api/v4/projects/462/merge_requests/1/commits)

  3. parent_ids value should be defined for commits (when FF is disabled, it will be missing)

  4. Find a merge request diff version from this endpoint (http://gdk.test:3000/api/v4/projects/462/merge_requests/1/versions/)

  5. Visit merge request diff version page (http://gdk.test:3000/api/v4/projects/462/merge_requests/1/versions/2180)

  6. parent_ids value should be defined for commits (when FF is disabled, it will be missing. Note endpoint response is cached)

Related to #496665 (closed)

Merge request reports

Loading