summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <mail@zjvandeweg.nl>2016-02-12 19:42:25 +0100
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2016-03-15 20:21:11 +0100
commit228007dfbcd8f97c66c1802f3b69abd7d02c7d26 (patch)
treed548ef9928b96816b7987b97eff4c8028c1ca30f /app/services
parentbc590ce63bd2f1af5545b648e6d028a557e7c792 (diff)
downloadgitlab-ce-228007dfbcd8f97c66c1802f3b69abd7d02c7d26.tar.gz
new-branch-button
Diffstat (limited to 'app/services')
-rw-r--r--app/services/merge_requests/build_service.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb
index 954746a39a5..8f1b735b8df 100644
--- a/app/services/merge_requests/build_service.rb
+++ b/app/services/merge_requests/build_service.rb
@@ -47,6 +47,17 @@ module MergeRequests
merge_request.title = merge_request.source_branch.titleize.humanize
end
+ # When your branch name starts with an iid followed by a dash this pattern will
+ # be interpreted as the use wants to close that issue on this project
+ # Pattern example: 112-fix-mep-mep
+ # Will lead to appending `Closes #112` to the description
+ if merge_request.source_branch =~ /\A\d+-/
+ closes_issue = "Closes ##{Regexp.last_match(0)[0...-1]}"
+ closes_issue.prepend("\n") if merge_request.description.present?
+
+ merge_request.description << closes_issue
+ end
+
merge_request
end