summaryrefslogtreecommitdiff
path: root/app/services/delete_branch_service.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-22 14:39:09 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-22 14:39:09 +0300
commit0455391add2032dddc7353d1b0ae36d591818d3f (patch)
treefac9a9328a36b7f54ace89dd992e50a6f35470bc /app/services/delete_branch_service.rb
parente089b11b7a4026acc7706e519682f4b7141b2bcd (diff)
downloadgitlab-ce-0455391add2032dddc7353d1b0ae36d591818d3f.tar.gz
Improve branch-removal logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services/delete_branch_service.rb')
-rw-r--r--app/services/delete_branch_service.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb
index 9f48ab4b60d..ce2d8093dff 100644
--- a/app/services/delete_branch_service.rb
+++ b/app/services/delete_branch_service.rb
@@ -8,6 +8,10 @@ class DeleteBranchService
return error('No such branch')
end
+ if branch_name == repository.root_ref
+ return error('Cannot remove HEAD branch')
+ end
+
# Dont allow remove of protected branch
if project.protected_branch?(branch_name)
return error('Protected branch cant be removed')