Commit c6ac6f07 authored by Patrick Steinhardt's avatar Patrick Steinhardt

gitaly_client: Don't check for pre-receive-errors in merge responses

Traditionally, Gitaly used to return successfully in case access checks
failed for either UserMergeBranch or UserMergeToRef, but it notified the
client that an error has occurred by setting the `pre_receive_error`
field. This has been changed upstream in Gitaly:

    - UserMergeBranch has been converted to make use of the rich gRPC
      error model and thus returns a proper error in case access checks
      fail.

    - UserMergeToRef has been converted to not do access checks at all
      anymore.

As a result, neither of those RPCs will ever return successfully with
the `pre_receive_error` field being set anymore. Gitaly has thus
deprecated those fieilds, which will soon go away completely.

Adapt the Gitaly client to not check for these fields anymore to be
prepared for the removal.
parent 007ad73d
......@@ -119,10 +119,6 @@ module Gitlab
response = GitalyClient.call(@repository.storage, :operation_service,
:user_merge_to_ref, request, timeout: GitalyClient.long_timeout)
if pre_receive_error = response.pre_receive_error.presence
raise Gitlab::Git::PreReceiveError, pre_receive_error
end
response.commit_id
end
......@@ -153,10 +149,6 @@ module Gitlab
second_response = response_enum.next
if second_response.pre_receive_error.present?
raise Gitlab::Git::PreReceiveError, second_response.pre_receive_error
end
branch_update = second_response.branch_update
return if branch_update.nil?
raise Gitlab::Git::CommitError, 'failed to apply merge to branch' unless branch_update.commit_id.present?
......
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