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
ea04ed78
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
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
5 deletions
+11
-5
app/models/commit.rb
app/models/commit.rb
+7
-1
app/views/projects/blame/show.html.haml
app/views/projects/blame/show.html.haml
+1
-1
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+1
-1
app/views/projects/commits/_inline_commit.html.haml
app/views/projects/commits/_inline_commit.html.haml
+1
-1
spec/models/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
...
@@ -27,8 +27,9 @@ class Commit
diffs
.
reduce
(
0
)
{
|
sum
,
d
|
sum
+
d
.
diff
.
lines
.
count
}
diffs
.
reduce
(
0
)
{
|
sum
,
d
|
sum
+
d
.
diff
.
lines
.
count
}
end
end
# Truncate sha to 8 characters
def
truncate_sha
(
sha
)
def
truncate_sha
(
sha
)
sha
[
0
..
10
]
sha
[
0
..
7
]
end
end
end
end
...
@@ -128,6 +129,11 @@ class Commit
...
@@ -128,6 +129,11 @@ class Commit
super
super
end
end
# Truncate sha to 8 characters
def
short_id
@raw
.
short_id
(
7
)
end
def
parents
def
parents
@parents
||=
Commit
.
decorate
(
super
)
@parents
||=
Commit
.
decorate
(
super
)
end
end
...
...
app/views/projects/blame/show.html.haml
View file @
ea04ed78
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
%tr
%tr
%td
.blame-commit
%td
.blame-commit
%span
.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
)
=
commit_author_link
(
commit
,
avatar:
true
,
size:
16
)
...
...
app/views/projects/commits/_commit.html.haml
View file @
ea04ed78
%li
.commit.js-toggle-container
%li
.commit.js-toggle-container
.commit-row-title
.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
%span
.str-truncated
=
link_to_gfm
commit
.
title
,
project_commit_path
(
project
,
commit
.
id
),
class:
"commit-row-message"
=
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
%li
.commit.inline-commit
.commit-row-title
.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
%span
.str-truncated
=
link_to_gfm
commit
.
title
,
project_commit_path
(
project
,
commit
.
id
),
class:
"commit-row-message"
=
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
...
@@ -75,7 +75,7 @@ eos
it_behaves_like
'a mentionable'
do
it_behaves_like
'a mentionable'
do
let
(
:subject
)
{
commit
}
let
(
:subject
)
{
commit
}
let
(
:mauthor
)
{
create
:user
,
email:
commit
.
author_email
}
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
)
}
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
stub
(
safe_message:
txt
)
}
}
# Include the subject in the repository stub.
# 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