diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-07 00:10:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-07 00:10:00 +0300 |
commit | 5f0e3773e9695fd0c9e92ea9180c8a1f5cfaa5c5 (patch) | |
tree | 64fc0ecbf508a24345ffe11d856fd13124c2e464 /app/models/merge_request_diff.rb | |
parent | 73886079f3f877ffb8f8938d700643a5e99bc849 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/merge_request_diff.rb')
-rw-r--r-- | app/models/merge_request_diff.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 7b15d21c095..ea3e00d9cd3 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -141,7 +141,7 @@ class MergeRequestDiff < ApplicationRecord after_create :save_git_content, unless: :importing? after_create_commit :set_as_latest_diff, unless: :importing? - after_save :update_external_diff_store, if: -> { !importing? && saved_change_to_external_diff? } + after_save :update_external_diff_store def self.find_by_diff_refs(diff_refs) find_by(start_commit_sha: diff_refs.start_sha, head_commit_sha: diff_refs.head_sha, base_commit_sha: diff_refs.base_sha) @@ -401,8 +401,10 @@ class MergeRequestDiff < ApplicationRecord end def update_external_diff_store - update_column(:external_diff_store, external_diff.object_store) if - has_attribute?(:external_diff_store) + return unless has_attribute?(:external_diff_store) + return unless saved_change_to_external_diff? || saved_change_to_stored_externally? + + update_column(:external_diff_store, external_diff.object_store) end def saved_change_to_external_diff? |