diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-01-31 16:32:44 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-02-25 10:40:58 -0300 |
commit | 1ad699677fa4b24a9bc002c6dc20164b8832bca5 (patch) | |
tree | 8018d8af35b14d78b20144788a0b271226347a9b /lib/gitlab/gitaly_client | |
parent | 992183534dd1af54bf891789aca5777ea91c0942 (diff) | |
download | gitlab-ce-1ad699677fa4b24a9bc002c6dc20164b8832bca5.tar.gz |
Support merge to ref for merge-commit and squash
Adds the ground work for writing into
the merge ref refs/merge-requests/:iid/merge the
merge result between source and target branches of
a MR, without further side-effects such as
mailing, MR updates and target branch changes.
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r-- | lib/gitlab/gitaly_client/operation_service.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb index 22d2d149e65..d172c798da2 100644 --- a/lib/gitlab/gitaly_client/operation_service.rb +++ b/lib/gitlab/gitaly_client/operation_service.rb @@ -100,6 +100,25 @@ module Gitlab end end + def user_merge_to_ref(user, source_sha, branch, target_ref, message) + request = Gitaly::UserMergeToRefRequest.new( + repository: @gitaly_repo, + source_sha: source_sha, + branch: encode_binary(branch), + target_ref: encode_binary(target_ref), + user: Gitlab::Git::User.from_gitlab(user).to_gitaly, + message: message + ) + + response = GitalyClient.call(@repository.storage, :operation_service, :user_merge_to_ref, request) + + if pre_receive_error = response.pre_receive_error.presence + raise Gitlab::Git::PreReceiveError, pre_receive_error + end + + response.commit_id + end + def user_merge_branch(user, source_sha, target_branch, message) request_enum = QueueEnumerator.new response_enum = GitalyClient.call( |