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 'lib/gitlab/conflict/file.rb')
-rw-r--r--lib/gitlab/conflict/file.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb
index fbf021345ca..d40a6323d4f 100644
--- a/lib/gitlab/conflict/file.rb
+++ b/lib/gitlab/conflict/file.rb
@@ -23,7 +23,7 @@ module Gitlab
# 'raw' holds the Gitlab::Git::Conflict::File that this instance wraps
attr_reader :raw
- delegate :type, :content, :their_path, :our_path, :our_mode, :our_blob, :repository, to: :raw
+ delegate :type, :content, :path, :ancestor_path, :their_path, :our_path, :our_mode, :our_blob, :repository, to: :raw
def initialize(raw, merge_request:)
@raw = raw
@@ -227,6 +227,26 @@ module Gitlab
new_path: our_path)
end
+ def conflict_type(diff_file)
+ if ancestor_path.present?
+ if our_path.present? && their_path.present?
+ :both_modified
+ elsif their_path.blank?
+ :modified_source_removed_target
+ else
+ :modified_target_removed_source
+ end
+ else
+ if our_path.present? && their_path.present?
+ :both_added
+ elsif their_path.blank?
+ diff_file.renamed_file? ? :renamed_same_file : :removed_target_renamed_source
+ else
+ :removed_source_renamed_target
+ end
+ end
+ end
+
private
def map_raw_lines(raw_lines)