diff --git a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb index 62d6eb00c7e639949866f9cb057220f15fb39e62..4fdf734772150c7c8ac82b082d3799276d5bf041 100644 --- a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb +++ b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb @@ -54,6 +54,7 @@ def create_commit(branch_name, change) def branch_name(identifiers) # Hyphen-case each identifier then join together with hyphens. branch_name = identifiers + .map { |i| i.gsub(/[^\w]+/, '-') } .map { |i| i.gsub(/[[:upper:]]/) { |w| "-#{w.downcase}" } } .join('-') .delete_prefix("-") diff --git a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb index 81c4342b95fe701d7fd786542353a2da143f4a2c..05d34b0490373576ee09ec5ef52badc45cc7319f 100644 --- a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb +++ b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb @@ -9,7 +9,7 @@ let(:logger) { instance_double(Logger, info: nil) } let(:git) { described_class.new(logger: logger) } let(:repository_path) { Pathname(Dir.mktmpdir) } - let(:test_branch_name) { 'gitlab-housekeeper--test-branch' } + let(:test_branch_name) { 'gitlab-housekeeper--some-class--test--branch_123' } let(:file_in_master) { 'file_in_master.txt' } let(:file_in_another_branch) { 'file_in_another_branch.txt' } @@ -57,7 +57,7 @@ def setup_and_checkout_another_branch split over multiple lines! COMMIT - change.identifiers = %w[GitlabHousekeeper TestBranch] + change.identifiers = %w[GitlabHousekeeper::SomeClass Test/Branch_123] Dir.mkdir('files') File.write(test_file1, "Content in file 1!")