diff options
author | Rémy Coutable <remy@rymai.me> | 2018-01-16 17:24:36 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-01-16 17:24:36 +0300 |
commit | a7d172625a8a8f31eb7730a343951c0de2436da0 (patch) | |
tree | 455d0fbe1c7d323540aefb8d9bbddea7b9d32dc5 /app | |
parent | 093856a75ed4a354286f7e6fc7a0f08d9d95a431 (diff) | |
parent | 91939161aace35823f7a60b25647d5e23285c556 (diff) |
Merge branch '41666-cannot-search-with-keyword-merge' into 'master'
Resolve "Cannot search with keyword "merge""
Closes #41666
See merge request gitlab-org/gitlab-ce!16462
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/blob_helper.rb | 2 | ||||
-rw-r--r-- | app/models/repository.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 5e3b2e5581c..a6e1de6ffdc 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -1,6 +1,8 @@ module BlobHelper def highlight(blob_name, blob_content, repository: nil, plain: false) + plain ||= blob_content.length > Blob::MAXIMUM_TEXT_HIGHLIGHT_SIZE highlighted = Gitlab::Highlight.highlight(blob_name, blob_content, plain: plain, repository: repository) + raw %(<pre class="code highlight"><code>#{highlighted}</code></pre>) end diff --git a/app/models/repository.rb b/app/models/repository.rb index a67bb7294e6..b4bc0f87458 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -932,7 +932,7 @@ class Repository return [] if empty? || query.blank? offset = 2 - args = %W(grep -i -I -n --before-context #{offset} --after-context #{offset} -E -e #{Regexp.escape(query)} #{ref || root_ref}) + args = %W(grep -i -I -n -z --before-context #{offset} --after-context #{offset} -E -e #{Regexp.escape(query)} #{ref || root_ref}) run_git(args).first.scrub.split(/^--$/) end |