Skip to content

Fix commit references being rendered inadvertently

Heinrich Lee Yu requested to merge 436120-fix-commit-reference-filter-order into master

What does this MR do and why?

We need to prioritize other reference filters because they accept formats with names / IDs that can be similar to a commit SHA that exists on the project

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.

How to set up and validate locally

  1. Find a commit SHA of a project
  2. Create a label in the project with the same name as the SHA
  3. In a Markdown field, reference the label using: ~<label name>

It should be rendered as a label and not a link to a commit

Same problem also happens with IDs, but it's much harder to reproduce:

  1. Find a project that has a commit SHA that starts with 8 numeric digits
  2. Create a label in the project and update the ID in the console to match the SHA
  3. In a Markdown field, reference the label using: ~<the label id>

On GitLab.com, we saw this happen with IDs because nobody really creates label names that are similar to SHAs. And our label ids are now 8 digits.

Related to #436120 (closed)

Edited by Heinrich Lee Yu

Merge request reports