Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-30 21:09:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-30 21:09:50 +0300
commit6619ed911ffab93b90756bf392d2925fdc0c1ee2 (patch)
tree79d122438dd8e1cb672f8bb52b9d573bd49bdd77 /app/models/issue.rb
parent4b1fc3dc32e768499d81ed64ea7ed497c1785c48 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 81b264a9ed7..ae76df30007 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -448,7 +448,13 @@ class Issue < ApplicationRecord
return to_branch_name unless project.repository.branch_exists?(to_branch_name)
start_counting_from = 2
- Uniquify.new(start_counting_from).string(-> (counter) { "#{to_branch_name}-#{counter}" }) do |suggested_branch_name|
+
+ branch_name_generator = -> (counter) do
+ suffix = counter > 5 ? SecureRandom.hex(8) : counter
+ "#{to_branch_name}-#{suffix}"
+ end
+
+ Uniquify.new(start_counting_from).string(branch_name_generator) do |suggested_branch_name|
project.repository.branch_exists?(suggested_branch_name)
end
end