summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-01-22 08:17:54 -0800
committerStan Hu <stanhu@gmail.com>2016-01-22 08:17:54 -0800
commit5972dedfcfda1826617092b018e68757c18d995a (patch)
treecd79406a3c27f3f3d72ddd9e4f3c13bcfecd074e /app/models/repository.rb
parent0e51ca7c4841bb388c0decb57ecc64af86c77805 (diff)
downloadgitlab-ce-5972dedfcfda1826617092b018e68757c18d995a.tar.gz
Ignore binary files in code search to prevent Error 500
Leaving out the -I option in "git grep" would cause an Error 500 because the resulting line would include "Binary file X matches"
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index d9ff71c01ed..9e8bd91fde9 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -598,7 +598,7 @@ class Repository
def search_files(query, ref)
offset = 2
- args = %W(#{Gitlab.config.git.bin_path} grep -i -n --before-context #{offset} --after-context #{offset} -e #{query} #{ref || root_ref})
+ args = %W(#{Gitlab.config.git.bin_path} grep -i -I -n --before-context #{offset} --after-context #{offset} -e #{query} #{ref || root_ref})
Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/)
end