2017-09-13 10:11:10 -04:00
|
|
|
module MergeRequests
|
|
|
|
# MergeService class
|
|
|
|
#
|
|
|
|
# Do git fast-forward merge and in case of success
|
|
|
|
# mark merge request as merged and execute all hooks and notifications
|
|
|
|
# Executed when you do fast-forward merge via GitLab UI
|
|
|
|
#
|
|
|
|
class FfMergeService < MergeRequests::MergeService
|
|
|
|
private
|
|
|
|
|
|
|
|
def commit
|
|
|
|
repository.ff_merge(current_user,
|
|
|
|
source,
|
|
|
|
merge_request.target_branch,
|
|
|
|
merge_request: merge_request)
|
2018-06-11 06:42:09 -04:00
|
|
|
rescue Gitlab::Git::PreReceiveError => e
|
2017-09-13 10:11:10 -04:00
|
|
|
raise MergeError, e.message
|
|
|
|
rescue StandardError => e
|
|
|
|
raise MergeError, "Something went wrong during merge: #{e.message}"
|
|
|
|
ensure
|
|
|
|
merge_request.update(in_progress_merge_commit_sha: nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|