parent
57fde5a83e
commit
ce3958ebae
2 changed files with 7 additions and 1 deletions
|
@ -854,7 +854,7 @@ class Repository
|
|||
|
||||
def search_files(query, ref)
|
||||
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(/^--$/)
|
||||
end
|
||||
|
||||
|
|
|
@ -100,6 +100,12 @@ describe Repository, models: true do
|
|||
expect(results.first).not_to start_with('fatal:')
|
||||
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
|
||||
subject { results.first }
|
||||
|
||||
|
|
Loading…
Reference in a new issue