summaryrefslogtreecommitdiff
path: root/app/models/merge_request_diff_commit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/merge_request_diff_commit.rb')
-rw-r--r--app/models/merge_request_diff_commit.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/app/models/merge_request_diff_commit.rb b/app/models/merge_request_diff_commit.rb
index d9a1784cdda..978e3af7fb4 100644
--- a/app/models/merge_request_diff_commit.rb
+++ b/app/models/merge_request_diff_commit.rb
@@ -6,6 +6,11 @@ class MergeRequestDiffCommit < ApplicationRecord
include BulkInsertSafe
include ShaAttribute
include CachedCommit
+ include IgnorableColumns
+
+ ignore_column %i[author_name author_email committer_name committer_email],
+ remove_with: '14.6',
+ remove_after: '2021-11-22'
belongs_to :merge_request_diff
@@ -51,9 +56,14 @@ class MergeRequestDiffCommit < ApplicationRecord
committer =
users[[commit_hash[:committer_name], commit_hash[:committer_email]]]
+ # These fields are only used to determine the author/committer IDs, we
+ # don't store them in the DB.
+ commit_hash = commit_hash
+ .except(:author_name, :author_email, :committer_name, :committer_email)
+
commit_hash.merge(
- commit_author_id: author&.id,
- committer_id: committer&.id,
+ commit_author_id: author.id,
+ committer_id: committer.id,
merge_request_diff_id: merge_request_diff_id,
relative_order: index,
sha: Gitlab::Database::ShaAttribute.serialize(sha), # rubocop:disable Cop/ActiveRecordSerialize
@@ -104,18 +114,18 @@ class MergeRequestDiffCommit < ApplicationRecord
end
def author_name
- commit_author_id ? commit_author.name : super
+ commit_author.name
end
def author_email
- commit_author_id ? commit_author.email : super
+ commit_author.email
end
def committer_name
- committer_id ? committer.name : super
+ committer.name
end
def committer_email
- committer_id ? committer.email : super
+ committer.email
end
end