diff options
Diffstat (limited to 'app/services/merge_requests/ff_merge_service.rb')
-rw-r--r-- | app/services/merge_requests/ff_merge_service.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/services/merge_requests/ff_merge_service.rb b/app/services/merge_requests/ff_merge_service.rb index cfbee3e2ff6..6f1fa607ef9 100644 --- a/app/services/merge_requests/ff_merge_service.rb +++ b/app/services/merge_requests/ff_merge_service.rb @@ -11,19 +11,21 @@ module MergeRequests private def commit - repository.ff_merge(current_user, - source, - merge_request.target_branch, - merge_request: merge_request) + ff_merge = repository.ff_merge(current_user, + source, + merge_request.target_branch, + merge_request: merge_request) + + if merge_request.squash + merge_request.update_column(:squash_commit_sha, merge_request.in_progress_merge_commit_sha) + end + + ff_merge rescue Gitlab::Git::PreReceiveError => e raise MergeError, e.message rescue StandardError => e raise MergeError, "Something went wrong during merge: #{e.message}" ensure - if merge_request.squash - merge_request.update_column(:squash_commit_sha, merge_request.in_progress_merge_commit_sha) - end - merge_request.update(in_progress_merge_commit_sha: nil) end end |