Commit e81d74b9 authored by Sean McGivern's avatar Sean McGivern

Merge branch '35199-case-insensitive-branches-search' into 'master'

Add case insensitive branches search

Closes #35199

See merge request gitlab-org/gitlab-ce!14995
parents 700ead2e 1cf35c3d
......@@ -23,7 +23,7 @@ class BranchesFinder
def filter_by_name(branches)
if search
branches.select { |branch| branch.name.include?(search) }
branches.select { |branch| branch.name.upcase.include?(search.upcase) }
else
branches
end
......
---
title: Case insensitive search for branches
merge_request: 14995
author: George Andrinopoulos
type: fixed
......@@ -46,6 +46,15 @@ describe BranchesFinder do
expect(result.count).to eq(1)
end
it 'filters branches by name ignoring letter case' do
branches_finder = described_class.new(repository, { search: 'FiX' })
result = branches_finder.execute
expect(result.first.name).to eq('fix')
expect(result.count).to eq(1)
end
it 'does not find any branch with that name' do
branches_finder = described_class.new(repository, { search: 'random' })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment