debian-mirror-gitlab/app/services/merge_requests/ff_merge_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.1 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
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
2019-12-26 22:10:19 +05:30
ff_merge = repository.ff_merge(current_user,
source,
merge_request.target_branch,
merge_request: merge_request)
2020-07-28 23:09:34 +05:30
if merge_request.squash_on_merge?
2019-12-26 22:10:19 +05:30
merge_request.update_column(:squash_commit_sha, merge_request.in_progress_merge_commit_sha)
end
ff_merge
2018-11-08 19:23:39 +05:30
rescue Gitlab::Git::PreReceiveError => e
2020-10-24 23:57:45 +05:30
Gitlab::ErrorTracking.track_exception(e, pre_receive_message: e.raw_message, merge_request_id: merge_request&.id)
2018-03-17 18:26:18 +05:30
raise MergeError, e.message
rescue StandardError => e
raise MergeError, "Something went wrong during merge: #{e.message}"
ensure
2021-01-03 14:25:43 +05:30
merge_request.update_and_mark_in_progress_merge_commit_sha(nil)
2018-03-17 18:26:18 +05:30
end
end
end