diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/helpers/diff_helper.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) | |
download | gitlab-ce-0c872e02b2c822e3397515ec324051ff540f0cd5.tar.gz |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r-- | app/helpers/diff_helper.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index e05adc5cd0e..e0a1697cfa9 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -76,13 +76,11 @@ module DiffHelper def diff_line_content(line) if line.blank? " ".html_safe - else + elsif line.start_with?('+', '-', ' ') # `sub` and substring-ing would destroy HTML-safeness of `line` - if line.start_with?('+', '-', ' ') - line[1, line.length] - else - line - end + line[1, line.length] + else + line end end @@ -227,7 +225,7 @@ module DiffHelper end def conflicts(allow_tree_conflicts: false) - return unless merge_request.cannot_be_merged? + return unless merge_request.cannot_be_merged? && merge_request.source_branch_exists? && merge_request.target_branch_exists? conflicts_service = MergeRequests::Conflicts::ListService.new(merge_request, allow_tree_conflicts: allow_tree_conflicts) # rubocop:disable CodeReuse/ServiceClass |