From ea04ed7879ad7177bef7a6dbe3bf90d76ebb8b45 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Oct 2014 16:30:14 +0300 Subject: Use 8chars short sha for commit in views Signed-off-by: Dmitriy Zaporozhets --- app/models/commit.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index c30a630429a..cbe0a39bc70 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -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 -- cgit v1.2.1