summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitaly_client
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2018-01-29 16:11:16 +0100
committerAhmad Sherif <me@ahmadsherif.com>2018-01-30 23:51:56 +0100
commit5aeb5ff51e8d25791c400301a627932e2f4091e8 (patch)
tree681592a76c8e877bb18018cd0461961ce2ea7ab2 /lib/gitlab/gitaly_client
parenta74413980bd9fa2a9b5dd8dbee8307f14063fbcb (diff)
downloadgitlab-ce-5aeb5ff51e8d25791c400301a627932e2f4091e8.tar.gz
Add support for PreReceiveError in UserMergeBranch RPCfix/add-support-for-pre-receive-error-in-merge-branch
Closes gitaly#979
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r--lib/gitlab/gitaly_client/operation_service.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb
index c2b4155e6a5..cd2734b5a07 100644
--- a/lib/gitlab/gitaly_client/operation_service.rb
+++ b/lib/gitlab/gitaly_client/operation_service.rb
@@ -103,7 +103,13 @@ module Gitlab
request_enum.push(Gitaly::UserMergeBranchRequest.new(apply: true))
- branch_update = response_enum.next.branch_update
+ second_response = response_enum.next
+
+ if second_response.pre_receive_error.present?
+ raise Gitlab::Git::HooksService::PreReceiveError, second_response.pre_receive_error
+ end
+
+ branch_update = second_response.branch_update
return if branch_update.nil?
raise Gitlab::Git::CommitError.new('failed to apply merge to branch') unless branch_update.commit_id.present?