summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorRubén Dávila <rdavila84@gmail.com>2016-02-02 20:51:37 -0500
committerRobert Speicher <rspeicher@gmail.com>2016-02-19 13:14:50 -0500
commitb6fe51b901ebba9892718df53b5c0b4515b8d758 (patch)
treec4876b8249d7f7a76a2b2ec31e3513a6acedecc2 /app/controllers
parent1708e1fc03439adec8e4f3aa341faaf6f378f192 (diff)
downloadgitlab-ce-b6fe51b901ebba9892718df53b5c0b4515b8d758.tar.gz
Some updates from last code review.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/merge_requests_controller.rb22
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