#888 prevent to remove source_branch
This commit is contained in:
parent
3b41b1839b
commit
d6ed9920d6
|
@ -189,7 +189,7 @@ class MergeRequest < ActiveRecord::Base
|
|||
self.merge!(current_user.id)
|
||||
true
|
||||
end
|
||||
rescue
|
||||
rescue
|
||||
self.mark_as_unmergable
|
||||
false
|
||||
end
|
||||
|
|
|
@ -114,5 +114,9 @@ module Project::RepositoryTrait
|
|||
def root_ref
|
||||
default_branch || "master"
|
||||
end
|
||||
|
||||
def root_ref? branch
|
||||
root_ref == branch
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,8 +65,9 @@
|
|||
= form_for [:automerge, @project, @merge_request], :remote => true, :method => :get do |f|
|
||||
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
|
||||
%br
|
||||
= check_box_tag :should_remove_source_branch
|
||||
= label_tag :should_remove_source_branch, "Remove source-branch"
|
||||
-unless @project.root_ref? @merge_request.source_branch
|
||||
= check_box_tag :should_remove_source_branch
|
||||
= label_tag :should_remove_source_branch, "Remove source-branch"
|
||||
|
||||
= f.submit "Accept Merge Request", :class => "btn small info accept_merge_request"
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ module Gitlab
|
|||
output = merge_repo.git.pull({}, "--no-ff", "origin", merge_request.source_branch)
|
||||
|
||||
#remove source-branch
|
||||
if merge_request.should_remove_source_branch
|
||||
if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch)
|
||||
merge_repo.git.sh "git push origin :#{merge_request.source_branch}"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue