summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-10-10 15:39:48 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-10-10 15:39:48 +0300
commit0189be0831350a5d473884a5b454a10509ff58ce (patch)
treeef542b26bfb32ea9cb29a618fef8f89dae6ff0d2 /app/models/commit.rb
parent9c824888c899393b5d72afe18b8bb0a134beec67 (diff)
downloadgitlab-ce-0189be0831350a5d473884a5b454a10509ff58ce.tar.gz
Use short_id instead of [0..N] for short version of commit sha
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb6
1 files changed, 5 insertions, 1 deletions
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)