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
This commit is contained in:
Dmitriy Zaporozhets 2015-02-20 17:05:53 +00:00
commit 5311de4091

View file

@ -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
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