diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index 30e0cbae024..a44b91166e8 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -50,12 +50,13 @@ module MergeRequests end commits = merge_request.compare_commits - merge_request.title = \ - if commits && commits.count == 1 - commits.first.title - else - merge_request.source_branch.titleize.humanize - end + if commits && commits.count == 1 + commit = commits.first + merge_request.title = commit.title + merge_request.description = commit.description.try(:strip) + else + merge_request.title = merge_request.source_branch.titleize.humanize + end merge_request