Skip to content

Add table for merge request commits

username-removed-443319 requested to merge merge-request-commits-table into master

Like https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12047, but for commits. The difference being that we don't store all of a commit's metadata in the DB any more, just a SHA, position, and MR diff ID. To get all the HEAD commit SHAs for an MR, for instance, you'd do something like:

SELECT sha
FROM merge_request_diff_commits
INNER JOIN merge_request_diffs ON merge_request_diff_commits.merge_request_diff_id = merge_request_diffs.id
WHERE merge_request_diffs.merge_request_id = $1
  AND relative_order = 0;

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/30224.

Still left

  • Add background migration to move old commits and diffs to their new tables
  • Handle missing commits on the commits tab
  • Ensure we don't call MergeRequestDiff#load_commits from anywhere except the commits tab
  • Fix Cycle Analytics for new and migrated MRs
Edited by username-removed-443319

Merge request reports