Commit 5311de40 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'mr-title-single-commit' into 'master'

Base new MR title on commit title if there's only one.

Closes #2029.

See merge request !1558
parents bba0b9f9 8830cfaa
......@@ -16,9 +16,6 @@ module MergeRequests
return build_failed(merge_request, nil)
end
# Generate suggested MR title based on source branch name
merge_request.title = merge_request.source_branch.titleize.humanize
compare_result = CompareService.new.execute(
current_user,
merge_request.source_project,
......@@ -52,6 +49,14 @@ module MergeRequests
merge_request.compare_failed = false
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
merge_request
rescue Gitlab::Satellite::BranchesWithoutParent
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment