Skip to content

Fix note creation error for SHA256 repositories

What does this MR do and why?

Contributes to #463793 (closed)

Problem

Note model uses a json validation to verify the schema of the position field. This validation fails because SHA256 repository generates commits with a length 64 instead of standard 40.

Solution

Extend validation to accept SHA256 commit hashes with length 64.

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_2024-11-28_at_14.46.35 Screenshot_2024-11-28_at_14.45.14

How to set up and validate locally

  1. Enable feature flag Feature.enable(:support_sha256_repositories) in Rails console
  2. Create a new project with SHA256 repository

Screenshot_2024-09-02_at_13.26.40

  1. Make changes (update file for example) and create a new branch with a merge request
  2. Try to leave a comment on the merge request changes (select a line of code, not just a regular comment)
  3. It should work without any errors
Edited by Joe Woodward

Merge request reports

Loading