mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-23 03:26:07 +10:00
Use 8chars short sha for commit in views
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%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"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%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"
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user