Commit 238897eb authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ref-finder-performance-improvement' into 'master'

Minor performance improvement for ref finder

See merge request gitlab-org/gitlab!58099
parents e4d50f0d 33627d2c
...@@ -33,15 +33,21 @@ class GitRefsFinder ...@@ -33,15 +33,21 @@ class GitRefsFinder
end end
def filter_refs_with_prefix(refs, prefix) def filter_refs_with_prefix(refs, prefix)
refs.select { |ref| ref.name.upcase.starts_with?(prefix.upcase) } prefix = prefix.downcase
refs.select { |ref| ref.name.downcase.starts_with?(prefix) }
end end
def filter_refs_with_suffix(refs, suffix) def filter_refs_with_suffix(refs, suffix)
refs.select { |ref| ref.name.upcase.ends_with?(suffix.upcase) } suffix = suffix.downcase
refs.select { |ref| ref.name.downcase.ends_with?(suffix) }
end end
def filter_refs_by_name(refs, term) def filter_refs_by_name(refs, term)
refs.select { |ref| ref.name.upcase.include?(term.upcase) } term = term.downcase
refs.select { |ref| ref.name.downcase.include?(term) }
end end
def set_exact_match_as_first_result(matches, term) def set_exact_match_as_first_result(matches, term)
......
---
title: Minor performance improvement for ref finder
merge_request: 58099
author:
type: performance
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