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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
31dee2e5
Commit
31dee2e5
authored
Jan 16, 2020
by
Marcel van Remmerden
Committed by
Phil Hughes
Jan 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change --no-commit-message to No commit message
Updates content and styling of commits with empty message
parent
9e85c758
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
10 deletions
+30
-10
app/assets/javascripts/repository/components/last_commit.vue
app/assets/javascripts/repository/components/last_commit.vue
+5
-1
app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
...vascripts/repository/queries/pathLastCommit.query.graphql
+1
-0
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+2
-2
changelogs/unreleased/issue-28822-add-style-to-no-commit-message.yml
...unreleased/issue-28822-add-style-to-no-commit-message.yml
+5
-0
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+1
-1
spec/frontend/repository/components/last_commit_spec.js
spec/frontend/repository/components/last_commit_spec.js
+12
-2
spec/lib/gitlab/git/commit_spec.rb
spec/lib/gitlab/git/commit_spec.rb
+1
-1
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+3
-3
No files found.
app/assets/javascripts/repository/components/last_commit.vue
View file @
31dee2e5
...
...
@@ -104,7 +104,11 @@ export default {
</span>
<div
class=
"commit-detail flex-list"
>
<div
class=
"commit-content qa-commit-content"
>
<gl-link
:href=
"commit.webUrl"
class=
"commit-row-message item-title"
>
<gl-link
:href=
"commit.webUrl"
:class=
"
{ 'font-italic': !commit.message }"
class="commit-row-message item-title"
>
{{
commit
.
title
}}
</gl-link>
<gl-button
...
...
app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
View file @
31dee2e5
...
...
@@ -6,6 +6,7 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
sha
title
description
message
webUrl
authoredDate
authorName
...
...
app/views/projects/commits/_commit.html.haml
View file @
31dee2e5
...
...
@@ -21,9 +21,9 @@
.commit-detail.flex-list
.commit-content.qa-commit-content
-
if
view_details
&&
merge_request
=
link_to
commit
.
title
,
project_commit_path
(
project
,
commit
.
id
,
merge_request_iid:
merge_request
.
iid
),
class:
"commit-row-message item-title js-onboarding-commit-item"
=
link_to
commit
.
title
,
project_commit_path
(
project
,
commit
.
id
,
merge_request_iid:
merge_request
.
iid
),
class:
[
"commit-row-message item-title js-onboarding-commit-item"
,
(
"font-italic"
if
commit
.
message
.
empty?
)]
-
else
=
link_to_markdown_field
(
commit
,
:title
,
link
,
class:
"commit-row-message item-title js-onboarding-commit-item"
)
=
link_to_markdown_field
(
commit
,
:title
,
link
,
class:
"commit-row-message item-title js-onboarding-commit-item
#{
"font-italic"
if
commit
.
message
.
empty?
}
"
)
%span
.commit-row-message.d-inline.d-sm-none
·
=
commit
.
short_id
...
...
changelogs/unreleased/issue-28822-add-style-to-no-commit-message.yml
0 → 100644
View file @
31dee2e5
---
title
:
Updated no commit verbiage
merge_request
:
22765
author
:
type
:
other
lib/gitlab/git/commit.rb
View file @
31dee2e5
...
...
@@ -254,7 +254,7 @@ module Gitlab
end
def
no_commit_message
"
--n
o commit message"
"
N
o commit message"
end
def
to_hash
...
...
spec/frontend/repository/components/last_commit_spec.js
View file @
31dee2e5
...
...
@@ -6,7 +6,7 @@ import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link
let
vm
;
function
createCommitData
(
data
=
{})
{
return
{
const
defaultData
=
{
sha
:
'
123456789
'
,
title
:
'
Commit title
'
,
message
:
'
Commit message
'
,
...
...
@@ -26,8 +26,8 @@ function createCommitData(data = {}) {
group
:
{},
},
},
...
data
,
};
return
Object
.
assign
(
defaultData
,
data
);
}
function
factory
(
commit
=
createCommitData
(),
loading
=
false
)
{
...
...
@@ -46,6 +46,8 @@ function factory(commit = createCommitData(), loading = false) {
vm
.
vm
.
$apollo
.
queries
.
commit
.
loading
=
loading
;
}
const
emptyMessageClass
=
'
font-italic
'
;
describe
(
'
Repository last commit component
'
,
()
=>
{
afterEach
(()
=>
{
vm
.
destroy
();
...
...
@@ -135,4 +137,12 @@ describe('Repository last commit component', () => {
expect
(
vm
.
element
).
toMatchSnapshot
();
});
});
it
(
'
sets correct CSS class if the commit message is empty
'
,
()
=>
{
factory
(
createCommitData
({
message
:
''
}));
return
vm
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
vm
.
find
(
'
.item-title
'
).
classes
()).
toContain
(
emptyMessageClass
);
});
});
});
spec/lib/gitlab/git/commit_spec.rb
View file @
31dee2e5
...
...
@@ -57,7 +57,7 @@ describe Gitlab::Git::Commit, :seed_helper do
it
{
expect
(
@commit
.
different_committer?
).
to
be_truthy
}
it
{
expect
(
@commit
.
parents
).
to
eq
(
@gitlab_parents
)
}
it
{
expect
(
@commit
.
parent_id
).
to
eq
(
@parents
.
first
.
oid
)
}
it
{
expect
(
@commit
.
no_commit_message
).
to
eq
(
"
--n
o commit message"
)
}
it
{
expect
(
@commit
.
no_commit_message
).
to
eq
(
"
N
o commit message"
)
}
after
do
# Erase the new commit so other tests get the original repo
...
...
spec/models/commit_spec.rb
View file @
31dee2e5
...
...
@@ -277,7 +277,7 @@ describe Commit do
describe
'#title'
do
it
"returns no_commit_message when safe_message is blank"
do
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
''
)
expect
(
commit
.
title
).
to
eq
(
"
--n
o commit message"
)
expect
(
commit
.
title
).
to
eq
(
"
N
o commit message"
)
end
it
'truncates a message without a newline at natural break to 80 characters'
do
...
...
@@ -308,7 +308,7 @@ eos
describe
'#full_title'
do
it
"returns no_commit_message when safe_message is blank"
do
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
''
)
expect
(
commit
.
full_title
).
to
eq
(
"
--n
o commit message"
)
expect
(
commit
.
full_title
).
to
eq
(
"
N
o commit message"
)
end
it
"returns entire message if there is no newline"
do
...
...
@@ -330,7 +330,7 @@ eos
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
(
'
--n
o commit message'
)
expect
(
commit
.
description
).
to
eq
(
'
N
o commit message'
)
end
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