summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2019-02-28 14:14:15 +0000
committerMark Chao <mchao@gitlab.com>2019-03-06 15:51:44 +0800
commitb14de8e1f519b9b874033f783051814129af176c (patch)
tree05ebee82e8aa39f4d22bef8602107433e006efba /lib
parent2609c2a73e8f8efc4fdd5e13c5378ffae7e4f9ef (diff)
downloadgitlab-ce-b14de8e1f519b9b874033f783051814129af176c.tar.gz
Add option to expand diff to full file
The user can also toggle between the diff changes and the full file diff. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/19054
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/file.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb
index c9d89d56884..88340f044c0 100644
--- a/lib/gitlab/diff/file.rb
+++ b/lib/gitlab/diff/file.rb
@@ -329,6 +329,16 @@ module Gitlab
lines
end
+ def fully_expanded?
+ return true if binary?
+
+ lines = diff_lines_for_serializer
+
+ return true if lines.nil?
+
+ lines.none? { |line| line.type.to_s == 'match' }
+ end
+
private
def total_blob_lines(blob)