summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-07-18 21:28:24 +0000
committerDouwe Maan <douwe@gitlab.com>2016-07-18 21:28:24 +0000
commitf0b446e55506b251e85afd4bb063586bccb52eb2 (patch)
treeadd624d0c1caa0e76a1a9fea3148306e42a696fa /lib
parent3d9c7a0e215355823c182f9302547a0e8e0a1b56 (diff)
parenta404ab380db5959ab22b09bc586607b1f6c507cd (diff)
downloadgitlab-ce-f0b446e55506b251e85afd4bb063586bccb52eb2.tar.gz
Merge branch '19820-safer-diffs' into 'master'
Collapsed diffs lines/size don't accumulate to overflow diffs. ## What does this MR do? Reduce the number of lines that we highlight on big diffs to try to reduce the degradation introduced by !4990 as you can see on the issue description #19820 . We collapse any files after the diff is over the number of safe files (100), or over the safe lines (500) or over the safe number of bytes (5KB x 100 files). We still need to bump the gitlab_git and point this branch to the new gitlab_git version. ## What are the relevant issue numbers? Closes #19820 Closes #19885 ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - ~~[ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - ~~[ ] API support added~~ - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5306
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/file.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb
index 7e01f7b61fb..b09ca1fb8b0 100644
--- a/lib/gitlab/diff/file.rb
+++ b/lib/gitlab/diff/file.rb
@@ -5,7 +5,7 @@ module Gitlab
delegate :new_file, :deleted_file, :renamed_file,
:old_path, :new_path, :a_mode, :b_mode,
- :submodule?, :too_large?, to: :diff, prefix: false
+ :submodule?, :too_large?, :collapsed?, to: :diff, prefix: false
def initialize(diff, repository:, diff_refs: nil)
@diff = diff
@@ -68,10 +68,6 @@ module Gitlab
@lines ||= Gitlab::Diff::Parser.new.parse(raw_diff.each_line).to_a
end
- def collapsed_by_default?
- diff.diff.bytesize > 10240 # 10 KB
- end
-
def highlighted_diff_lines
@highlighted_diff_lines ||= Gitlab::Diff::Highlight.new(self, repository: self.repository).highlight
end