GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 35081a77 authored by Toon Claes's avatar Toon Claes

Make Delete Merged Branches handle wildcard protected branches correctly

The "Delete Merged Branches" button should filter out protected
branches matching the wildcard patterns.

Closes gitlab-org/gitlab-ce#35592.
parent 1b117e7f
......@@ -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|, current_user).execute(branch)
title: Make Delete Merged Branches handle wildcard protected branches correctly
merge_request: 13251
......@@ -32,6 +32,14 @@ describe DeleteMergedBranchesService do
expect(project.repository.branch_names).to include('improve/awesome')
it 'keeps wildcard protected branches' do
create(:protected_branch, project: project, name: 'improve/*')
expect(project.repository.branch_names).to include('improve/awesome')
context 'user without rights' do
let(:user) { create(:user) }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment