diff options
author | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2016-02-12 21:42:25 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-15 22:21:11 +0300 |
commit | 228007dfbcd8f97c66c1802f3b69abd7d02c7d26 (patch) | |
tree | d548ef9928b96816b7987b97eff4c8028c1ca30f /app/services/merge_requests/build_service.rb | |
parent | bc590ce63bd2f1af5545b648e6d028a557e7c792 (diff) |
new-branch-button
Diffstat (limited to 'app/services/merge_requests/build_service.rb')
-rw-r--r-- | app/services/merge_requests/build_service.rb | 11 |
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 |