Skip to content

Ensure code search results link to searched ref

What does this MR do?

Code searches allow you to choose branch name or tag when searching for code. Previously the blob search results were linking to the URL with the SHA of the branch and not the actual branch name being searched. This works OK in some cases but usually the user expecting to be linked to /master/ instead of /<some-sha>/ and in particular it is problematic because when you are loading a file in a specific SHA you cannot click the edit button to edit that file you just loaded.

We fix this by using the param repository_ref when present and defaulting to the default_branch when absent.

See more at #254932 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

#254932 (closed)

Edited by Dylan Griffith

Merge request reports