Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
b6f8d010
Commit
b6f8d010
authored
Oct 25, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dirceu/gitlab-ce-fix-project-search-with-unmatched-parentheses'
parents
9b937046
d7bcfe4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
app/models/repository.rb
app/models/repository.rb
+1
-1
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+1
-1
spec/lib/gitlab/project_search_results_spec.rb
spec/lib/gitlab/project_search_results_spec.rb
+2
-2
No files found.
app/models/repository.rb
View file @
b6f8d010
...
@@ -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
...
...
lib/gitlab/project_search_results.rb
View file @
b6f8d010
...
@@ -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
)
...
...
spec/lib/gitlab/project_search_results_spec.rb
View file @
b6f8d010
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment