diff options
-rw-r--r-- | app/models/repository.rb | 14 | ||||
-rw-r--r-- | app/views/projects/commit/_revert.html.haml | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 6c1cd308a41..ca31a3f7ce6 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -628,18 +628,16 @@ class Repository target_sha = find_branch(target_branch).try(:target) # First make revert in temp branch - rm_branch(target_branch) if target_sha + rm_branch(user, target_branch) if target_sha success = revert_commit(user, commit, target_branch, base_branch) # Make the revert happen in the target branch - if success && !create_mr - source_sha = find_branch(target_branch).target - target_sha = find_branch(base_branch).target - has_changes = is_there_something_to_merge?(source_sha, target_sha) + source_sha = find_branch(target_branch).target + target_sha = find_branch(base_branch).target + has_changes = is_there_something_to_merge?(source_sha, target_sha) - if has_changes - success = revert_commit(user, commit, base_branch, base_branch) - end + if has_changes && !create_mr + success = revert_commit(user, commit, base_branch, base_branch) end has_changes && success diff --git a/app/views/projects/commit/_revert.html.haml b/app/views/projects/commit/_revert.html.haml index f8f98d90248..15f50724e8a 100644 --- a/app/views/projects/commit/_revert.html.haml +++ b/app/views/projects/commit/_revert.html.haml @@ -9,7 +9,7 @@ .form-group.branch = label_tag 'target_branch', 'Target branch', class: 'control-label' .col-sm-10 - = text_field_tag 'target_branch', nil, required: true, class: "form-control js-target-branch" + = select_tag "target_branch", grouped_options_refs, class: "select2 select2-sm js-target-branch" - if can?(current_user, :push_code, @project) .js-create-merge-request-container .checkbox |