diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-08 15:29:56 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-08 15:29:56 +0000 |
commit | 0108387053ac78bb2354511950fb5847a033e5d5 (patch) | |
tree | 15ad870c3b0adc2fac5ec18562b580c5afffc6ae /app | |
parent | 358e8141cdcef5b4fae6554a89576c7837e102d6 (diff) | |
parent | 869696bca3d8ff72e2dbaa96744eb7a7d560f0cf (diff) | |
download | gitlab-ce-0108387053ac78bb2354511950fb5847a033e5d5.tar.gz |
Merge branch 'faster_project_search' into 'master'
Faster search inside Project
See merge request !7353
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 30be7262438..7d06ce1e85b 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1064,6 +1064,10 @@ class Repository end def search_files(query, ref) + unless exists? && has_visible_content? && query.present? + return [] + end + offset = 2 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(/^--$/) |