diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-10 16:30:14 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-10 16:30:14 +0300 |
commit | ea04ed7879ad7177bef7a6dbe3bf90d76ebb8b45 (patch) | |
tree | 349f1cae12c591208780b44d0e04c53679f72ad5 /app/models/commit.rb | |
parent | daa55f31d899819069ddbaa9596769a233b5a729 (diff) | |
download | gitlab-ce-ea04ed7879ad7177bef7a6dbe3bf90d76ebb8b45.tar.gz |
Use 8chars short sha for commit in views
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 8 |
1 files changed, 7 insertions, 1 deletions
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 |