summaryrefslogtreecommitdiff
path: root/app/models/issue.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index b9b481ac29b..91bef81227f 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -206,7 +206,16 @@ class Issue < ApplicationRecord
if self.confidential?
"#{iid}-confidential-issue"
else
- "#{iid}-#{title.parameterize}"
+ branch_name = "#{iid}-#{title.parameterize}"
+
+ if branch_name.length > 100
+ truncated_string = branch_name[0, 100]
+ # Delete everything dangling after the last hyphen so as not to risk
+ # existence of unintended words in the branch name due to mid-word split.
+ branch_name = truncated_string[0, truncated_string.rindex("-")]
+ end
+
+ branch_name
end
end