summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-08-24 10:56:57 +0000
committerDouwe Maan <douwe@gitlab.com>2017-08-24 10:56:57 +0000
commit610155e063251036f35aadd4dc0f707d1738e54b (patch)
tree9dbd6ad3a86ace2e889e9b8772f8f10f3bd84cd0 /lib
parent43238a40abb5602fdbf82492faf8041af01139a5 (diff)
parente8525e107da9234d743caf8a0c7db1f46af60e89 (diff)
downloadgitlab-ce-610155e063251036f35aadd4dc0f707d1738e54b.tar.gz
Merge branch 'fix-old-mr-diffs' into 'master'
Fix old MR diffs Closes #36516 See merge request !13744
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/file.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb
index 6d7de52cb80..1dabd4ebdd0 100644
--- a/lib/gitlab/diff/file.rb
+++ b/lib/gitlab/diff/file.rb
@@ -186,7 +186,10 @@ module Gitlab
end
def content_changed?
- old_blob && new_blob && old_blob.id != new_blob.id
+ return blobs_changed? if diff_refs
+ return false if new_file? || deleted_file? || renamed_file?
+
+ text? && diff_lines.any?
end
def different_type?
@@ -225,6 +228,10 @@ module Gitlab
private
+ def blobs_changed?
+ old_blob && new_blob && old_blob.id != new_blob.id
+ end
+
def simple_viewer_class
return DiffViewer::NotDiffable unless diffable?
@@ -250,6 +257,8 @@ module Gitlab
DiffViewer::Renamed
elsif mode_changed?
DiffViewer::ModeChanged
+ else
+ DiffViewer::NoPreview
end
end