Commit 2bacfda2 authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

Truncate recommended branch name to a sane length

Signed-off-by: default avatarBalasankar "Balu" C <balasankar@gitlab.com>
parent b1a088ec
......@@ -206,7 +206,7 @@ class Issue < ApplicationRecord
if self.confidential?
"#{iid}-confidential-issue"
else
"#{iid}-#{title.parameterize}"
"#{iid}-#{title.parameterize}"[0, 99]
end
end
......
---
title: Truncate recommended branch name to a sane length
merge_request: 18821
author:
type: changed
......@@ -423,6 +423,14 @@ describe Issue do
issue = create(:issue, title: 'testing-issue', confidential: true)
expect(issue.to_branch_name).to match /confidential-issue\z/
end
context 'issue title longer than 100 characters' do
let(:issue) { create(:issue, iid: 999, title: 'Lorem ipsum dolor sit amet consectetur adipiscing elit Mauris sit amet ipsum id lacus fringilla convallis') }
it "truncates title part of branch name to 100 characters" do
expect(issue.to_branch_name).to eq("999-lorem-ipsum-dolor-sit-amet-consectetur-adipiscing-elit-mauris-sit-amet-ipsum-id-lacus-fringilla")
end
end
end
describe '#can_be_worked_on?' do
......
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