mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-20 14:11:11 +00:00
Merge branch '36328-deserializemergerequestdiffsandcommits-fails-due-to-null-too_large-column-9-5-rc1' into 'master'
Fix merge request diff deserialisation when too_large was absent Closes #36328 See merge request !13500
This commit is contained in:
@ -85,6 +85,8 @@ module Gitlab
|
||||
diff_hash.tap do |hash|
|
||||
diff_text = hash[:diff]
|
||||
|
||||
hash[:too_large] = !!hash[:too_large]
|
||||
|
||||
if diff_text.encoding == Encoding::BINARY && !diff_text.ascii_only?
|
||||
hash[:binary] = true
|
||||
hash[:diff] = [diff_text].pack('m0')
|
||||
|
@ -123,6 +123,17 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits do
|
||||
include_examples 'updated MR diff'
|
||||
end
|
||||
|
||||
context 'when the merge request diffs do not have too_large set' do
|
||||
let(:commits) { merge_request_diff.commits.map(&:to_hash) }
|
||||
let(:expected_diffs) { diffs_to_hashes(merge_request_diff.merge_request_diff_files) }
|
||||
|
||||
let(:diffs) do
|
||||
expected_diffs.map { |diff| diff.except(:too_large) }
|
||||
end
|
||||
|
||||
include_examples 'updated MR diff'
|
||||
end
|
||||
|
||||
context 'when the merge request diffs have binary content' do
|
||||
let(:commits) { merge_request_diff.commits.map(&:to_hash) }
|
||||
let(:expected_diffs) { diffs }
|
||||
|
Reference in New Issue
Block a user