Commit 8830cfaa authored by Douwe Maan's avatar Douwe Maan

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

parent 6b0199ff
...@@ -16,9 +16,6 @@ module MergeRequests ...@@ -16,9 +16,6 @@ module MergeRequests
return build_failed(merge_request, nil) return build_failed(merge_request, nil)
end end
# Generate suggested MR title based on source branch name
merge_request.title = merge_request.source_branch.titleize.humanize
compare_result = CompareService.new.execute( compare_result = CompareService.new.execute(
current_user, current_user,
merge_request.source_project, merge_request.source_project,
...@@ -52,6 +49,14 @@ module MergeRequests ...@@ -52,6 +49,14 @@ module MergeRequests
merge_request.compare_failed = false merge_request.compare_failed = false
end 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 merge_request
rescue Gitlab::Satellite::BranchesWithoutParent 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