diff options
author | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-05 14:29:17 +0300 |
---|---|---|
committer | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-16 12:13:17 +0300 |
commit | 603ef5d49ed453cbb47b68d3af078529c6b834a1 (patch) | |
tree | 14075d8b3311e9f48fdb33e4ed3ea840eafa7a68 /app/models/merge_request.rb | |
parent | 99dd58ec557779eadd83aa597d8c16996be60df1 (diff) |
Show either description or closes issues references on MergeRequest#merge_commit_message so closes issues references are not duplicated
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 48c30b08502..da293c3738f 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -633,18 +633,20 @@ class MergeRequest < ActiveRecord::Base issue.to_reference(target_project) end - message = "Merge branch '#{source_branch}' into '#{target_branch}'\n\n" - message << "#{title}\n\n" + message = [ + "Merge branch '#{source_branch}' into '#{target_branch}'", + title + ] - if closes_issues_references.present? + if !include_description && closes_issues_references.present? issue_text = 'issue'.pluralize(closes_issues_references.size) - message << "Closes #{issue_text} #{closes_issues_references.to_sentence}\n\n" + message << "Closes #{issue_text} #{closes_issues_references.to_sentence}" end - message << "#{description}\n\n" if include_description && description.present? + message << "#{description}" if include_description && description.present? message << "See merge request #{to_reference}" - message + message.join("\n\n") end def reset_merge_when_build_succeeds |