Commit d759da76 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'osw-avoid-encoding-errors-on-merge-to-ref-service' into 'master'

Handle encoding errors for MergeToRefService

See merge request gitlab-org/gitlab-ce!29440
parents e5dcd110 8d7fb292
---
title: Handle encoding errors for MergeToRefService
merge_request: 29440
author:
type: fixed
...@@ -107,7 +107,7 @@ module Gitlab ...@@ -107,7 +107,7 @@ module Gitlab
branch: encode_binary(branch), branch: encode_binary(branch),
target_ref: encode_binary(target_ref), target_ref: encode_binary(target_ref),
user: Gitlab::Git::User.from_gitlab(user).to_gitaly, user: Gitlab::Git::User.from_gitlab(user).to_gitaly,
message: message message: encode_binary(message)
) )
response = GitalyClient.call(@repository.storage, :operation_service, :user_merge_to_ref, request) response = GitalyClient.call(@repository.storage, :operation_service, :user_merge_to_ref, request)
......
...@@ -78,6 +78,24 @@ describe Gitlab::GitalyClient::OperationService do ...@@ -78,6 +78,24 @@ describe Gitlab::GitalyClient::OperationService do
subject subject
end end
describe '#user_merge_to_ref' do
let(:branch) { 'my-branch' }
let(:source_sha) { 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660' }
let(:ref) { 'refs/merge-requests/x/merge' }
let(:message) { 'validación' }
let(:response) { Gitaly::UserMergeToRefResponse.new(commit_id: 'new-commit-id') }
subject { client.user_merge_to_ref(user, source_sha, branch, ref, message) }
it 'sends a user_merge_to_ref message' do
expect_any_instance_of(Gitaly::OperationService::Stub)
.to receive(:user_merge_to_ref).with(kind_of(Gitaly::UserMergeToRefRequest), kind_of(Hash))
.and_return(response)
subject
end
end
context "when pre_receive_error is present" do context "when pre_receive_error is present" do
let(:response) do let(:response) do
Gitaly::UserUpdateBranchResponse.new(pre_receive_error: "GitLab: something failed") Gitaly::UserUpdateBranchResponse.new(pre_receive_error: "GitLab: something failed")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment