diff options
author | Sean McGivern <sean@gitlab.com> | 2016-06-28 19:25:32 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-07-08 12:56:55 +0300 |
commit | b6b26692ea44cfeab7e8fd64b7df60852850fce2 (patch) | |
tree | 3f54b14b7b8500d0182d7e5eca653b313eec17e2 /lib/gitlab/diff/file.rb | |
parent | 2c650b6f30d2e76cf632d6ce5771859aed67ac48 (diff) |
Collapse large diffs by default
When rendering a list of diff files, skip those where the diff is over
10 KB and provide an endpoint to render individually instead.
Diffstat (limited to 'lib/gitlab/diff/file.rb')
-rw-r--r-- | lib/gitlab/diff/file.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb index b0c50edba59..7e01f7b61fb 100644 --- a/lib/gitlab/diff/file.rb +++ b/lib/gitlab/diff/file.rb @@ -68,6 +68,10 @@ 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 |