Select branch dropdown when cherry picking commit is inconsistent

Problem

When cherry-picking a commit, the select branch dropdown should filter by the currently selected branch.

This works in some projects but not in others, such as gitlab-org.

Update

It seems the search which filters the list of branches checks if the search term is contained within a branch.

This logic results in the branch "master" being lost in the list of other branches which also contain the word "master", as seen in the screenshot.

The following snippet of code is responsible
return this.joinedBranches.filter((resultString) =>
  resultString.toLowerCase().includes(lowerCasedSearchTerm),
);

Screenshots

Expected Actual
Screenshot_2023-01-19_at_10.30.56 Screenshot_2023-01-19_at_10.03.36

Steps to Recreate

  1. Go to the list of commits in https://gitlab.com/gitlab-org/gitlab/
  2. Select Commit
  3. Select Options > Cherry-pick
  4. Click on dropdown "Pick into branch"

Related

Related to this issue which highlights the undesirable UX for this dropdown.

Possible Solution

Based on the discussion here: !110012 (comment 1255182921). Don't filter the list of items by default and push selected branch to the top of the list.

Default With Search
Screenshot_2023-01-26_at_13.06.45 Screenshot_2023-01-26_at_13.15.54
Edited by Ross Byrne