diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-26 16:36:17 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-26 16:36:17 +0200 |
commit | cb90368a692149b4e01b50d7c6682c48cffa438b (patch) | |
tree | 6236d6f4fd56acad1015950d483db0ba8fa3ada9 /app/models/commit.rb | |
parent | c6f19aed51736e5945283a611eae09f32a9b5aeb (diff) | |
parent | f127edd012bd8b6f76ac67d69aadbd7d4837258f (diff) | |
download | gitlab-ce-cb90368a692149b4e01b50d7c6682c48cffa438b.tar.gz |
Merge remote-tracking branch 'origin/master' into with-pipeline-view
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 9ffdcc59128..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) @@ -154,7 +154,7 @@ class Commit id: id, message: safe_message, timestamp: committed_date.xmlschema, - url: commit_url, + url: Gitlab::UrlBuilder.build(self), author: { name: author_name, email: author_email @@ -168,10 +168,6 @@ class Commit data end - def commit_url - project.present? ? "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/#{id}" : "" - end - # Discover issues should be closed when this commit is pushed to a project's # default branch. def closes_issues(current_user = self.committer) @@ -223,6 +219,10 @@ class Commit 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 @@ -258,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 |