Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb12
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