Skip to content

Refactor MergeRequest#current_patch_id_sha and move to the diff

What does this MR do and why?

Currently the SSOT of the patch_id exists in the merge request class, however, for it to be closer to the source, it should exist in the merge request diff class. The patch_id has not been backfilled, and rather we are going with a backfill on access approach.

To test:

  • Create a new MR
  • bundle exec rails c
  • MergeRequestDiff.last.attributes['patch_id_sha'] should be set
  • Ensure the patch_id is set
  • MergeRequestDiff.last.update!(patch_id_sha: nil)
  • MergeRequestDiff.last.attributes[:patch_id_sha] should be nil
  • MergeRequestDiff.last.get_patch_id_sha should return
  • MergeRequestDiff.last.attributes[:patch_id_sha] should be the same as returned

Related to #426087 (closed)

Edited by Marc Shaw

Merge request reports