summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-07-27 11:22:05 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-07-27 11:22:05 +0300
commit0590aa9d6073e79ba47c4fe5c34318f6889c44d8 (patch)
treec7dfcfa0fc1f4f5f76946dffdce04542bcd1ecda /app/models/commit.rb
parent67ef96ea5f721cc620f3e931f05d918c904ec74e (diff)
downloadgitlab-ce-0590aa9d6073e79ba47c4fe5c34318f6889c44d8.tar.gz
commit.short_id as model method. Styled inline comment form
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 859bee29fa5..71c41350c95 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -114,6 +114,10 @@ class Commit
@head = head
end
+ def short_id(length = 10)
+ id.to_s[0..length]
+ end
+
def safe_message
utf8 message
end
@@ -150,4 +154,8 @@ class Commit
def prev_commit_id
prev_commit.try :id
end
+
+ def parents_count
+ parents && parents.count || 0
+ end
end