BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ea04ed78
Unverified
Commit
ea04ed78
authored
Oct 10, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 8chars short sha for commit in views
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
daa55f31
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
5 deletions
+11
-5
commit.rb
app/models/commit.rb
+7
-1
show.html.haml
app/views/projects/blame/show.html.haml
+1
-1
_commit.html.haml
app/views/projects/commits/_commit.html.haml
+1
-1
_inline_commit.html.haml
app/views/projects/commits/_inline_commit.html.haml
+1
-1
commit_spec.rb
spec/models/commit_spec.rb
+1
-1
No files found.
app/models/commit.rb
View file @
ea04ed78
...
...
@@ -27,8 +27,9 @@ class Commit
diffs
.
reduce
(
0
)
{
|
sum
,
d
|
sum
+
d
.
diff
.
lines
.
count
}
end
# Truncate sha to 8 characters
def
truncate_sha
(
sha
)
sha
[
0
..
10
]
sha
[
0
..
7
]
end
end
...
...
@@ -128,6 +129,11 @@ class Commit
super
end
# Truncate sha to 8 characters
def
short_id
@raw
.
short_id
(
7
)
end
def
parents
@parents
||=
Commit
.
decorate
(
super
)
end
...
...
app/views/projects/blame/show.html.haml
View file @
ea04ed78
...
...
@@ -15,7 +15,7 @@
%tr
%td
.blame-commit
%span
.commit
=
link_to
commit
.
short_id
(
8
)
,
project_commit_path
(
@project
,
commit
),
class:
"commit_short_id"
=
link_to
commit
.
short_id
,
project_commit_path
(
@project
,
commit
),
class:
"commit_short_id"
=
commit_author_link
(
commit
,
avatar:
true
,
size:
16
)
...
...
app/views/projects/commits/_commit.html.haml
View file @
ea04ed78
%li
.commit.js-toggle-container
.commit-row-title
=
link_to
commit
.
short_id
(
8
)
,
project_commit_path
(
project
,
commit
),
class:
"commit_short_id"
=
link_to
commit
.
short_id
,
project_commit_path
(
project
,
commit
),
class:
"commit_short_id"
%span
.str-truncated
=
link_to_gfm
commit
.
title
,
project_commit_path
(
project
,
commit
.
id
),
class:
"commit-row-message"
...
...
app/views/projects/commits/_inline_commit.html.haml
View file @
ea04ed78
%li
.commit.inline-commit
.commit-row-title
=
link_to
commit
.
short_id
(
8
)
,
project_commit_path
(
project
,
commit
),
class:
"commit_short_id"
=
link_to
commit
.
short_id
,
project_commit_path
(
project
,
commit
),
class:
"commit_short_id"
%span
.str-truncated
=
link_to_gfm
commit
.
title
,
project_commit_path
(
project
,
commit
.
id
),
class:
"commit-row-message"
...
...
spec/models/commit_spec.rb
View file @
ea04ed78
...
...
@@ -75,7 +75,7 @@ eos
it_behaves_like
'a mentionable'
do
let
(
:subject
)
{
commit
}
let
(
:mauthor
)
{
create
:user
,
email:
commit
.
author_email
}
let
(
:backref_text
)
{
"commit
#{
subject
.
short_
id
}
"
}
let
(
:backref_text
)
{
"commit
#{
subject
.
id
}
"
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
stub
(
safe_message:
txt
)
}
}
# Include the subject in the repository stub.
...
...
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