summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-04-29 09:32:51 +0100
committerSean McGivern <sean@gitlab.com>2016-04-29 09:32:51 +0100
commit8db1116f33b2e3075beab734494c232559adcbc2 (patch)
treef95c5fe1304b26865f7f2b5d2667525e9a72b7d6
parent0dfff8402c4ac89270f6e8901062289c3d7e4834 (diff)
downloadgitlab-ce-8db1116f33b2e3075beab734494c232559adcbc2.tar.gz
fixup! Auto-set title for branches created from issues
-rw-r--r--app/services/merge_requests/build_service.rb32
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