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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d7bcfe4f
Commit
d7bcfe4f
authored
Oct 14, 2015
by
Dirceu Pereira Tiegs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue #3055 (project search with unmatched parentheses)
parent
976400c1
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 @
d7bcfe4f
...
@@ -482,7 +482,7 @@ class Repository
...
@@ -482,7 +482,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 @
d7bcfe4f
...
@@ -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 @
d7bcfe4f
...
@@ -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