Draft: fix: branch icon missing in repository selector

Relates to issue #574489

Changes

This MR fixes the missing branch/tag icons in the repository selector when visiting repository pages without ref_type in the URL parameters.

Key Changes:

  1. lib/extracts_ref/ref_extractor.rb

    • Added inferred_ref_type to attr_accessor to store the inferred reference type
    • Modified extract! method to infer ref_type using RequestedRef when params[:ref_type] is not provided
    • The inferred ref_type is stored and used to set the fully qualified ref
  2. lib/extracts_path.rb

    • Updated assign_ref_vars to store @inferred_ref_type from ref_extractor
    • Modified ref_type method to return inferred value as fallback: ExtractsRef::RefExtractor.ref_type(params[:ref_type]) || @inferred_ref_type
  3. Controllers (Verification)

    • Confirmed tree_controller.rb, commits_controller.rb, and blob_controller.rb already have @ref_type = ref_type which will now use the inferred value

Expected Behavior:

When visiting repository pages without ref_type in the URL (e.g., /gitlab-org/gitlab/-/tree/master):

  1. Backend infers that "master" is a branch → sets @inferred_ref_type = 'heads'
  2. Backend sets @fully_qualified_ref = 'refs/heads/master'
  3. Frontend receives refType='heads' and displays the correct branch icon
  4. Same logic applies for tags → refType='tags' with tag icon

This ensures consistent icon display across all repository pages, matching the behavior already working on the Commits page.

Edited by Joe Woodward

Merge request reports

Loading