Commit d7bcfe4f authored by Dirceu Pereira Tiegs's avatar Dirceu Pereira Tiegs

Fix issue #3055 (project search with unmatched parentheses)

parent 976400c1
......@@ -482,7 +482,7 @@ class Repository
def search_files(query, ref)
offset = 2
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref})
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} -e #{query} #{ref || root_ref})
Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/)
end
......
......@@ -9,7 +9,7 @@ module Gitlab
else
nil
end
@query = Shellwords.shellescape(query) if query.present?
@query = query
end
def objects(scope, page = nil)
......
......@@ -9,7 +9,7 @@ describe Gitlab::ProjectSearchResults do
it { expect(results.project).to eq(project) }
it { expect(results.repository_ref).to be_nil }
it { expect(results.query).to eq('hello\\ world') }
it { expect(results.query).to eq('hello world') }
end
describe 'initialize with ref' do
......@@ -18,6 +18,6 @@ describe Gitlab::ProjectSearchResults do
it { expect(results.project).to eq(project) }
it { expect(results.repository_ref).to eq(ref) }
it { expect(results.query).to eq('hello\\ world') }
it { expect(results.query).to eq('hello world') }
end
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