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/models/merge_request_diff.rb')
-rw-r--r--app/models/merge_request_diff.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index bddc03d8b21..900f4bcfeb2 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -210,6 +210,8 @@ class MergeRequestDiff < ApplicationRecord
# and save it to the database as serialized data
def save_git_content
ensure_commit_shas
+ set_patch_id_sha
+
save_commits
save_diffs
@@ -223,6 +225,16 @@ class MergeRequestDiff < ApplicationRecord
keep_around_commits unless importing?
end
+ def set_patch_id_sha
+ return unless base_commit_sha && head_commit_sha
+ return if base_commit_sha == head_commit_sha
+
+ self.patch_id_sha = project.repository&.get_patch_id(
+ base_commit_sha,
+ head_commit_sha
+ )
+ end
+
def set_as_latest_diff
# Don't set merge_head diff as latest so it won't get considered as the
# MergeRequest#merge_request_diff.