diff options
author | Sean McGivern <sean@gitlab.com> | 2017-08-22 18:27:09 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-08-24 13:11:18 +0300 |
commit | e8525e107da9234d743caf8a0c7db1f46af60e89 (patch) | |
tree | 75be1e6d69d9049d976d41699dec4e62b5cfeb4e /lib | |
parent | b0f09406f50882c7e085c2a9b853be5dcf3d79dd (diff) |
Show un-highlighted diffs when blobs are the same
For some old merge requests, we don't have enough information to figure out the
old blob and the new blob for the file. This means that we can't highlight the
diff correctly, but we can still display it without highlighting.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/diff/file.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb index 17a9ec01637..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? |