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
Tatuya Kamada
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
Hide 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
def
search_files
(
query
,
ref
)
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
(
/^--$/
)
end
...
...
spec/models/repository_spec.rb
View file @
ce3958eb
...
...
@@ -100,6 +100,12 @@ describe Repository, models: true do
expect
(
results
.
first
).
not_to
start_with
(
'fatal:'
)
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
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