Commit d6ed9920d68691472fe9f9a9247508573c64bae4
1 parent
3b41b183
Exists in
master
and in
4 other branches
#888 prevent to remove source_branch
Showing
4 changed files
with
9 additions
and
4 deletions
Show diff stats
app/models/merge_request.rb
app/models/project/repository_trait.rb
app/views/merge_requests/show.html.haml
... | ... | @@ -65,8 +65,9 @@ |
65 | 65 | = form_for [:automerge, @project, @merge_request], :remote => true, :method => :get do |f| |
66 | 66 | You can accept this request automatically. If you still want to do it manually - #{link_to "click here", "#", :class => "how_to_merge_link vlink", :title => "How To Merge"} for instructions |
67 | 67 | %br |
68 | - = check_box_tag :should_remove_source_branch | |
69 | - = label_tag :should_remove_source_branch, "Remove source-branch" | |
68 | + -unless @project.root_ref? @merge_request.source_branch | |
69 | + = check_box_tag :should_remove_source_branch | |
70 | + = label_tag :should_remove_source_branch, "Remove source-branch" | |
70 | 71 | |
71 | 72 | = f.submit "Accept Merge Request", :class => "btn small info accept_merge_request" |
72 | 73 | ... | ... |
lib/gitlab/merge.rb
... | ... | @@ -50,7 +50,7 @@ module Gitlab |
50 | 50 | output = merge_repo.git.pull({}, "--no-ff", "origin", merge_request.source_branch) |
51 | 51 | |
52 | 52 | #remove source-branch |
53 | - if merge_request.should_remove_source_branch | |
53 | + if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) | |
54 | 54 | merge_repo.git.sh "git push origin :#{merge_request.source_branch}" |
55 | 55 | end |
56 | 56 | ... | ... |