diff options
-rw-r--r-- | app/services/merge_requests/build_service.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index 4b64910fff8..931c40c6f1a 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -43,22 +43,20 @@ module MergeRequests private + # When your branch name starts with an iid followed by a dash this pattern will be + # interpreted as the user wants to close that issue on this project. + # + # For example: + # - Issue 112 exists, title: Emoji don't show up in commit title + # - Source branch is: 112-fix-mep-mep + # + # Will lead to: + # - Appending `Closes #112` to the description + # - Setting the title as 'Resolves "Emoji don't show up in commit title"' if there is + # more than one commit in the MR + # def set_title_and_description(merge_request) - # When your branch name starts with an iid followed by a dash this pattern will be - # interpreted as the user wants to close that issue on this project. - # - # For example: - # - Issue 112 exists, title: Emoji don't show up in commit title - # - Source branch is: 112-fix-mep-mep - # - # Will lead to: - # - Appending `Closes #112` to the description - # - Setting the title as 'Resolves "Emoji don't show up in commit title"' if there - # is more than one commit in the MR - # - if match = merge_request.source_branch.match(/\A(\d+)-/) - iid = match[1] - end + iid = match[1] if match = merge_request.source_branch.match(/\A(\d+)-/) commits = merge_request.compare_commits if commits && commits.count == 1 @@ -68,9 +66,9 @@ module MergeRequests elsif iid && (issue = merge_request.target_project.get_issue(iid)) && !issue.try(:confidential?) case issue when Issue - merge_request.title = "Resolves \"#{issue.title}\"" + merge_request.title = "Resolve \"#{issue.title}\"" when ExternalIssue - merge_request.title = "Resolves #{issue.title}" + merge_request.title = "Resolve #{issue.title}" end else merge_request.title = merge_request.source_branch.titleize.humanize |