From 0189be0831350a5d473884a5b454a10509ff58ce Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Oct 2014 15:39:48 +0300 Subject: Use short_id instead of [0..N] for short version of commit sha Signed-off-by: Dmitriy Zaporozhets --- app/models/commit.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index a1343b65c72..61551df9e27 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -26,6 +26,10 @@ class Commit def diff_line_count(diffs) diffs.reduce(0) { |sum, d| sum + d.diff.lines.count } end + + def truncate_sha(sha) + sha[0..10] + end end attr_accessor :raw @@ -111,7 +115,7 @@ class Commit # Mentionable override. def gfm_reference - "commit #{sha[0..5]}" + "commit #{short_id}" end def method_missing(m, *args, &block) -- cgit v1.2.1