Commit d6ed9920 authored by Zevs's avatar Zevs

#888 prevent to remove source_branch

parent 3b41b183
...@@ -114,5 +114,9 @@ module Project::RepositoryTrait ...@@ -114,5 +114,9 @@ module Project::RepositoryTrait
def root_ref def root_ref
default_branch || "master" default_branch || "master"
end end
def root_ref? branch
root_ref == branch
end
end end
end end
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
= form_for [:automerge, @project, @merge_request], :remote => true, :method => :get do |f| = 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 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 %br
-unless @project.root_ref? @merge_request.source_branch
= check_box_tag :should_remove_source_branch = check_box_tag :should_remove_source_branch
= label_tag :should_remove_source_branch, "Remove source-branch" = label_tag :should_remove_source_branch, "Remove source-branch"
......
...@@ -50,7 +50,7 @@ module Gitlab ...@@ -50,7 +50,7 @@ module Gitlab
output = merge_repo.git.pull({}, "--no-ff", "origin", merge_request.source_branch) output = merge_repo.git.pull({}, "--no-ff", "origin", merge_request.source_branch)
#remove 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}" merge_repo.git.sh "git push 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