Commit bd165421 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix-fork-branch-removal' into 'master'

Don't show remove branch checkbox for MR from fork

Fixes #1359

See merge request !942
parents 00455a47 d390219c
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
.accept-group .accept-group
.pull-left .pull-left
= f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request" = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
- if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork?
.remove_branch_holder.pull-left .remove_branch_holder.pull-left
= label_tag :should_remove_source_branch, class: "checkbox" do = label_tag :should_remove_source_branch, class: "checkbox" do
= check_box_tag :should_remove_source_branch = check_box_tag :should_remove_source_branch
......
...@@ -31,8 +31,9 @@ module Gitlab ...@@ -31,8 +31,9 @@ module Gitlab
# push merge back to bare repo # push merge back to bare repo
# will raise CommandFailed when push fails # will raise CommandFailed when push fails
merge_repo.git.push(default_options, :origin, merge_request.target_branch) merge_repo.git.push(default_options, :origin, merge_request.target_branch)
# remove source branch # remove source branch
if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) && !merge_request.for_fork?
# will raise CommandFailed when push fails # will raise CommandFailed when push fails
merge_repo.git.push(default_options, :origin, ":#{merge_request.source_branch}") merge_repo.git.push(default_options, :origin, ":#{merge_request.source_branch}")
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment