Show correct branch or tag icon in ref selector
What does this MR do and why?
Show correct branch or tag icon in ref selector
When viewing the repository tree, blob, or commits, the page contains a ref selector so you can view the tree, blob, or commits within a specific ref. This ref can be a tag, branch, or commit SHA.
When we specify the ref_type in the URL we correctly display the type of ref that has been selected by showing a branch or tag icon next to the ref name.
When no ref_type is present we check if the ref is ambiguous i.e. a tag and branch with that name exists, and then present a modal asking the user to pick which ref_type they are expecting.
We didn't however, infer the ref type if the ref is unambiguous.
This change attempts to infer the ref_type and assigns it to @ref_type so the frontend can correctly pass this information into Vue and render the icons.
Changelog: fixed
References
Repository branch selector not showing branch icon (#574489)
Screenshots or screen recordings
Testing locally
Visit a project's repository view. Make sure the URL doesn't contain ?ref_type=... and remove if it does. Check that the ref_selector includes an branch icon. You can also select a tag, repeat the process and should display a tag icon.
-
https://gdk.test:3443/gitlab-org/gitlab-test/-/blob/allow-empty-1-graphql/files/whitespace -
https://gdk.test:3443/gitlab-org/gitlab-test/-/blob/allow-empty-1-graphql/files -
🏷️ https://gdk.test:3443/gitlab-org/gitlab-test/-/tree/v18.6.2-ee/workhorse -
🏷️ https://gdk.test:3443/gitlab-org/gitlab-test/-/blob/v18.6.2-ee/workhorse/.golangci.yml

