Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5759bfe0
Commit
5759bfe0
authored
Aug 21, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it clearer when Commit#description returns no_commit_message
parent
e3f13c9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
app/models/commit.rb
app/models/commit.rb
+2
-5
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+5
-4
No files found.
app/models/commit.rb
View file @
5759bfe0
...
...
@@ -193,12 +193,9 @@ 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?
if
safe_message
.
blank?
no_commit_message
else
safe_message
.
split
(
"
\n
"
,
2
)[
1
].
try
(
:chomp
)
end
safe_message
.
split
(
"
\n
"
,
2
)[
1
].
try
(
:chomp
)
end
def
description?
...
...
spec/models/commit_spec.rb
View file @
5759bfe0
...
...
@@ -225,11 +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
(
''
)
expect
(
commit
.
description
).
to
eq
(
"--no commit message"
)
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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment