summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-04-21 16:03:33 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-04-21 16:03:33 -0500
commitc9fe9f59d27bacb60c264678cce3cbe45d514a69 (patch)
tree0c7c497a5fbb96264d0c19a08aee17ad31f7fb05 /app/models/commit.rb
parent80ae3790b456b12314243c75632ed6024ac16424 (diff)
parentc22c4048ce1a4233c0a6f9a9cd59a53efe49da53 (diff)
downloadgitlab-ce-c9fe9f59d27bacb60c264678cce3cbe45d514a69.tar.gz
Merge remote-tracking branch 'origin/master' into issue_3799
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index d1f07ccd55c..562c3ed15b2 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -15,8 +15,8 @@ class Commit
DIFF_SAFE_LINES = Gitlab::Git::DiffCollection::DEFAULT_LIMITS[:max_lines]
# Commits above this size will not be rendered in HTML
- DIFF_HARD_LIMIT_FILES = 1000 unless defined?(DIFF_HARD_LIMIT_FILES)
- DIFF_HARD_LIMIT_LINES = 50000 unless defined?(DIFF_HARD_LIMIT_LINES)
+ DIFF_HARD_LIMIT_FILES = 1000
+ DIFF_HARD_LIMIT_LINES = 50000
class << self
def decorate(commits, project)
@@ -207,17 +207,22 @@ class Commit
@raw.short_id(7)
end
- def ci_commit
- project.ci_commit(sha)
+ def ci_commits
+ @ci_commits ||= project.ci_commits.where(sha: sha)
end
def status
- ci_commit.try(:status) || :not_found
+ return @status if defined?(@status)
+ @status ||= ci_commits.status
end
def revert_branch_name
"revert-#{short_id}"
end
+
+ def cherry_pick_branch_name
+ project.repository.next_branch("cherry-pick-#{short_id}", mild: true)
+ end
def revert_description
if merged_merge_request
@@ -253,6 +258,10 @@ class Commit
end.any? { |commit_ref| commit_ref.reverts_commit?(self) }
end
+ def change_type_title
+ merged_merge_request ? 'merge request' : 'commit'
+ end
+
private
def repo_changes