BigW Consortium Gitlab

Commit fee12f99 by Rémy Coutable Committed by James Edwards-Jones

Merge branch 'tc-fix-wildcard-protected-delete-merged' into 'master'

Make Delete Merged Branches handle wildcard protected branches correctly Closes #35592 See merge request !13251
parent c0fa5f25
......@@ -11,7 +11,7 @@ class DeleteMergedBranchesService < BaseService
# Prevent deletion of branches relevant to open merge requests
branches -= merge_request_branch_names
# Prevent deletion of protected branches
branches -= project.protected_branches.pluck(:name)
branches = branches.reject { |branch| project.protected_for?(branch) }
branches.each do |branch|
DeleteBranchService.new(project, current_user).execute(branch)
......
---
title: Make Delete Merged Branches handle wildcard protected branches correctly
merge_request: 13251
author:
......@@ -32,6 +32,14 @@ describe DeleteMergedBranchesService, services: true do
expect(project.repository.branch_names).to include('improve/awesome')
end
it 'keeps wildcard protected branches' do
create(:protected_branch, project: project, name: 'improve/*')
service.execute
expect(project.repository.branch_names).to include('improve/awesome')
end
context 'user without rights' do
let(:user) { create(:user) }
......
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