Force source and target branch to binary mode
This commit is contained in:
parent
1edf1807c5
commit
df650eaae5
|
@ -65,8 +65,8 @@ module Gitlab
|
||||||
our_commit_oid: @our_commit_oid,
|
our_commit_oid: @our_commit_oid,
|
||||||
target_repository: target_repository.gitaly_repository,
|
target_repository: target_repository.gitaly_repository,
|
||||||
their_commit_oid: @their_commit_oid,
|
their_commit_oid: @their_commit_oid,
|
||||||
source_branch: source_branch,
|
source_branch: encode_binary(source_branch),
|
||||||
target_branch: target_branch,
|
target_branch: encode_binary(target_branch),
|
||||||
commit_message: encode_binary(resolution.commit_message),
|
commit_message: encode_binary(resolution.commit_message),
|
||||||
user: Gitlab::Git::User.from_gitlab(resolution.user).to_gitaly
|
user: Gitlab::Git::User.from_gitlab(resolution.user).to_gitaly
|
||||||
)
|
)
|
||||||
|
|
|
@ -51,16 +51,23 @@ describe Gitlab::GitalyClient::ConflictsService do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'handles commit messages with UTF-8 characters' do
|
context 'with branches with UTF-8 characters' do
|
||||||
allow(::Gitlab::GitalyClient).to receive(:call).and_call_original
|
let(:source_branch) { 'testòbranch' }
|
||||||
expect(::Gitlab::GitalyClient).to receive(:call).with(anything, :conflicts_service, :resolve_conflicts, any_args) do |*args|
|
let(:target_branch) { 'ábranch' }
|
||||||
# Force the generation of request messages by iterating through the enumerator
|
|
||||||
args[3].to_a
|
|
||||||
|
|
||||||
double(resolution_error: nil)
|
it 'handles commit messages with UTF-8 characters' do
|
||||||
|
allow(::Gitlab::GitalyClient).to receive(:call).and_call_original
|
||||||
|
expect(::Gitlab::GitalyClient).to receive(:call).with(anything, :conflicts_service, :resolve_conflicts, any_args) do |*args|
|
||||||
|
# Force the generation of request messages by iterating through the enumerator
|
||||||
|
message = args[3].to_a.first
|
||||||
|
params = [message.header.commit_message, message.header.source_branch, message.header.target_branch]
|
||||||
|
expect(params.map(&:encoding).uniq).to eq([Encoding::ASCII_8BIT])
|
||||||
|
|
||||||
|
double(resolution_error: nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
subject
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'raises a relevant exception if resolution_error is present' do
|
it 'raises a relevant exception if resolution_error is present' do
|
||||||
|
|
Loading…
Reference in New Issue