[go: up one dir, main page]

Skip to content

Backfill merge_requests.merged_commit_sha

Problem to solve

In !129311 (merged), we added a new column merged_commit_sha to merge_requests that keeps track of the SHA that got merged, regardless of the merge method.

Once backfilled, we can simplify the implementation of the #merged_commit_sha method (simplicity), and reduce the UNIONs in .by_related_commit_sha (performance).

Proposal

Backfill the column with the value of MergeRequest#merged_commit_sha as it was implemented prior to the addition of the explicit column:

  def merged_commit_sha
    return unless merged?

    sha = merge_commit_sha || squash_commit_sha || diff_head_sha
    sha.presence
  end