diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 0fcb3063f29..e9d07614785 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -193,18 +193,18 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def revert - target_branch_exists = @merge_request.target_branch_exists? - url_params = { merge_request: { - source_branch: @merge_request.revert_branch_name, - target_branch: @merge_request.target_branch, - source_project_id: @merge_request.target_project_id, - target_project_id: @merge_request.target_project_id, - description: @merge_request.revert_description - }} - - if target_branch_exists + url_params = { + merge_request: { source_branch: @merge_request.revert_branch_name, + target_branch: @merge_request.target_branch, + source_project_id: @merge_request.target_project_id, + target_project_id: @merge_request.target_project_id, + description: @merge_request.revert_description } + } + + if @merge_request.target_branch_exists? && @merge_request.merge_commit_sha.present? @repository.revert_merge(current_user, @merge_request.merge_commit_sha, - @merge_request.revert_branch_name, @merge_request.revert_title) + @merge_request.revert_branch_name, @merge_request.target_branch, + @merge_request.revert_title) redirect_to new_namespace_project_merge_request_url(@project.namespace, @project, url_params) else |