Commit b93d0f11 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Merge branch 'fix-hex-branch-deletion' into 'master'

Fix for hexadecimal branch deletion

See merge request gitlab-org/gitlab!75344
parents 5dd6be4b dc82ec85
......@@ -40,6 +40,7 @@ module Gitlab
private
def prohibited_branch_checks
return if deletion?
return unless Feature.enabled?(:prohibit_hexadecimal_branch_names, project, default_enabled: true)
if branch_name =~ /\A\h{40}\z/
......
......@@ -32,6 +32,15 @@ RSpec.describe Gitlab::Checks::BranchCheck do
expect { subject.validate! }.not_to raise_error
end
context "deleting a hexadecimal branch" do
let(:newrev) { "0000000000000000000000000000000000000000" }
let(:ref) { "refs/heads/267208abfe40e546f5e847444276f7d43a39503e" }
it "doesn't prohibit the deletion of a hexadecimal branch name" do
expect { subject.validate! }.not_to raise_error
end
end
context "the feature flag is disabled" do
it "doesn't prohibit a 40-character hexadecimal branch name" do
stub_feature_flags(prohibit_hexadecimal_branch_names: false)
......
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