Commit f9cf65a6 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'rs-issue-3055' into 'master'

Use extended regexp flag for `git grep`-ing files

Closes #3055

See merge request !4203
parents 5d031c86 ce3958eb
...@@ -854,7 +854,7 @@ def is_ancestor?(ancestor_id, descendant_id) ...@@ -854,7 +854,7 @@ def is_ancestor?(ancestor_id, descendant_id)
def search_files(query, ref) def search_files(query, ref)
offset = 2 offset = 2
args = %W(#{Gitlab.config.git.bin_path} grep -i -I -n --before-context #{offset} --after-context #{offset} -e #{Regexp.escape(query)} #{ref || root_ref}) args = %W(#{Gitlab.config.git.bin_path} grep -i -I -n --before-context #{offset} --after-context #{offset} -E -e #{Regexp.escape(query)} #{ref || root_ref})
Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/) Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/)
end end
......
...@@ -100,6 +100,12 @@ ...@@ -100,6 +100,12 @@
expect(results.first).not_to start_with('fatal:') expect(results.first).not_to start_with('fatal:')
end end
it 'properly handles an unmatched parenthesis' do
results = repository.search_files("test(", 'master')
expect(results.first).not_to start_with('fatal:')
end
describe 'result' do describe 'result' do
subject { results.first } subject { results.first }
......
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