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
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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