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
Léo-Paul Géneau
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
Show 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,13 +193,10 @@ class Commit
...
@@ -193,13 +193,10 @@ class Commit
# otherwise returns commit message without first line
# otherwise returns commit message without first line
def
description
def
description
return
safe_message
if
full_title
.
length
>=
100
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
)
safe_message
.
split
(
"
\n
"
,
2
)[
1
].
try
(
:chomp
)
end
end
end
def
description?
def
description?
description
.
present?
description
.
present?
...
...
spec/models/commit_spec.rb
View file @
5759bfe0
...
@@ -225,9 +225,10 @@ eos
...
@@ -225,9 +225,10 @@ eos
end
end
describe
'description'
do
describe
'description'
do
it
"returns no_commit_message when safe_message is blank"
do
it
'returns no_commit_message when safe_message is blank'
do
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
''
)
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
nil
)
expect
(
commit
.
description
).
to
eq
(
"--no commit message"
)
expect
(
commit
.
description
).
to
eq
(
'--no commit message'
)
end
end
it
'returns description of commit message if title less than 100 characters'
do
it
'returns description of commit message if title less than 100 characters'
do
...
...
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