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
7d18c4d2
Commit
7d18c4d2
authored
Dec 04, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Truncate merge request titles with periods instead of ellipsis
Closes
https://gitlab.com/gitlab-org/gitlab-ce/issues/54862
parent
acc785f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
app/models/commit.rb
app/models/commit.rb
+3
-1
changelogs/unreleased/sh-truncate-with-periods.yml
changelogs/unreleased/sh-truncate-with-periods.yml
+5
-0
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+1
-1
No files found.
app/models/commit.rb
View file @
7d18c4d2
...
...
@@ -177,7 +177,9 @@ class Commit
def
title
return
full_title
if
full_title
.
length
<
100
full_title
.
truncate
(
81
,
separator:
' '
,
omission:
'…'
)
# Use three dots instead of the ellipsis Unicode character because
# some clients show the raw Unicode value in the merge commit.
full_title
.
truncate
(
81
,
separator:
' '
,
omission:
'...'
)
end
# Returns the full commits title
...
...
changelogs/unreleased/sh-truncate-with-periods.yml
0 → 100644
View file @
7d18c4d2
---
title
:
Truncate merge request titles with periods instead of ellipsis
merge_request
:
23558
author
:
type
:
changed
spec/models/commit_spec.rb
View file @
7d18c4d2
...
...
@@ -204,7 +204,7 @@ describe Commit do
message
=
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.'
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
message
)
expect
(
commit
.
title
).
to
eq
(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id
felis…
'
)
expect
(
commit
.
title
).
to
eq
(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id
...
'
)
end
it
"truncates a message with a newline before 80 characters at the newline"
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