Commit b1cf3225 authored by Andrew McCallum's avatar Andrew McCallum

Move Regexp.escape(), fix formatting on tests.

parent a539e03d
......@@ -938,11 +938,11 @@ class Repository
end
def search_files_by_name(query, ref)
safe_query = query.sub(/^\/*/, "")
safe_query = Regexp.escape(query.sub(/^\/*/, ""))
return [] if empty? || safe_query.blank?
args = %W(ls-tree --full-tree -r #{ref || root_ref} --name-status | #{Regexp.escape(safe_query)})
args = %W(ls-tree --full-tree -r #{ref || root_ref} --name-status | #{safe_query})
run_git(args).first.lines.map(&:strip)
end
......
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