diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-31 09:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-31 09:09:17 +0300 |
commit | a9f214d42107c847fcc8fb2a5dff78ba17363e41 (patch) | |
tree | 5cffa8c1d0b21df5084c9958eb2b1b8049834fb2 /app/serializers | |
parent | 226c5810c9f0171ba0daceb1cd3d72b43860647a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/diff_file_entity.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/serializers/diff_file_entity.rb b/app/serializers/diff_file_entity.rb index ef856ee0116..9f8628fe849 100644 --- a/app/serializers/diff_file_entity.rb +++ b/app/serializers/diff_file_entity.rb @@ -56,8 +56,7 @@ class DiffFileEntity < DiffFileBaseEntity # Used for inline diffs expose :highlighted_diff_lines, using: DiffLineEntity, if: -> (diff_file, options) { inline_diff_view?(options) && diff_file.text? } do |diff_file| - file = conflict_file(options, diff_file) || diff_file - file.diff_lines_for_serializer + highlighted_diff_lines_for(diff_file, options) end expose :is_fully_expanded do |diff_file| @@ -89,6 +88,15 @@ class DiffFileEntity < DiffFileBaseEntity # If nothing is present, inline will be the default. options.fetch(:diff_view, :inline).to_sym end + + def highlighted_diff_lines_for(diff_file, options) + file = conflict_file(options, diff_file) || diff_file + + file.diff_lines_for_serializer + rescue Gitlab::Git::Conflict::Parser::UnmergeableFile + # Fallback to diff_file as it means that conflict lines can't be parsed due to limit + diff_file.diff_lines_for_serializer + end end DiffFileEntity.prepend_mod |