Commit e0372801 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'yisiliang/gitlab-ce-avoid-nil-safe_message' into 'master'

Avoid nil safe message

See merge request gitlab-org/gitlab-ce!21326
parents fd4e0292 26cc7ee6
......@@ -193,6 +193,7 @@ class Commit
# otherwise returns commit message without first line
def description
return safe_message if full_title.length >= 100
return no_commit_message if safe_message.blank?
safe_message.split("\n", 2)[1].try(:chomp)
end
......
---
title: "Avoid nil safe message"
merge_request: 21326
author: Yi Siliang
type: fixed
......@@ -225,6 +225,12 @@ eos
end
describe 'description' do
it 'returns no_commit_message when safe_message is blank' do
allow(commit).to receive(:safe_message).and_return(nil)
expect(commit.description).to eq('--no commit message')
end
it 'returns description of commit message if title less than 100 characters' do
message = <<eos
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit.
......
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