summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-20 22:17:38 +0100
committerDouwe Maan <douwe@gitlab.com>2015-02-20 22:17:38 +0100
commit2f76ccdfac59f7bb6875e0a7753a390d4f6f2b38 (patch)
treeb73c963293bee2fe69f51adbf9177ffccc58db5d /app
parent1f617c3c5ffd3b8b4d1eb29d9cda8a2e7a749133 (diff)
downloadgitlab-ce-2f76ccdfac59f7bb6875e0a7753a390d4f6f2b38.tar.gz
Base new MR description on commit description if there's only one.
Diffstat (limited to 'app')
-rw-r--r--app/services/merge_requests/build_service.rb13
1 files changed, 7 insertions, 6 deletions
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