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
iv
gitlab-ce
Commits
ce3958eb
Commit
ce3958eb
authored
May 18, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use extended regexp flag for `git grep`-ing files
Closes #3055
parent
57fde5a8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
app/models/repository.rb
app/models/repository.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+6
-0
No files found.
app/models/repository.rb
View file @
ce3958eb
...
@@ -854,7 +854,7 @@ class Repository
...
@@ -854,7 +854,7 @@ class Repository
def
search_files
(
query
,
ref
)
def
search_files
(
query
,
ref
)
offset
=
2
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
(
/^--$/
)
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
.
scrub
.
split
(
/^--$/
)
end
end
...
...
spec/models/repository_spec.rb
View file @
ce3958eb
...
@@ -100,6 +100,12 @@ describe Repository, models: true do
...
@@ -100,6 +100,12 @@ describe Repository, models: true do
expect
(
results
.
first
).
not_to
start_with
(
'fatal:'
)
expect
(
results
.
first
).
not_to
start_with
(
'fatal:'
)
end
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
describe
'result'
do
subject
{
results
.
first
}
subject
{
results
.
first
}
...
...
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