Commit b6f8d010 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'dirceu/gitlab-ce-fix-project-search-with-unmatched-parentheses'

parents 9b937046 d7bcfe4f
...@@ -496,7 +496,7 @@ class Repository ...@@ -496,7 +496,7 @@ class Repository
def search_files(query, ref) def search_files(query, ref)
offset = 2 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(/^--$/) Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/)
end end
......
...@@ -9,7 +9,7 @@ module Gitlab ...@@ -9,7 +9,7 @@ module Gitlab
else else
nil nil
end end
@query = Shellwords.shellescape(query) if query.present? @query = query
end end
def objects(scope, page = nil) def objects(scope, page = nil)
......
...@@ -9,7 +9,7 @@ describe Gitlab::ProjectSearchResults do ...@@ -9,7 +9,7 @@ describe Gitlab::ProjectSearchResults do
it { expect(results.project).to eq(project) } it { expect(results.project).to eq(project) }
it { expect(results.repository_ref).to be_nil } 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 end
describe 'initialize with ref' do describe 'initialize with ref' do
...@@ -18,6 +18,6 @@ describe Gitlab::ProjectSearchResults do ...@@ -18,6 +18,6 @@ describe Gitlab::ProjectSearchResults do
it { expect(results.project).to eq(project) } it { expect(results.project).to eq(project) }
it { expect(results.repository_ref).to eq(ref) } 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
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