diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-09-02 14:29:08 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-09-02 14:29:08 +0000 |
commit | 364fbf2adadd24349ab83b5b172ada1512464665 (patch) | |
tree | 94a919819616cacafa4a74455f32942af21d3d5a | |
parent | 0a41b340b4c575712bb3032f3e7636f3d00a8c92 (diff) | |
parent | 0ee5efbd20bf99385183618dc0bcf74deaa20075 (diff) | |
download | gitlab-ce-364fbf2adadd24349ab83b5b172ada1512464665.tar.gz |
Merge branch 'fix/merge-request-close-message' into 'master'
Prepend blank line to close message on merge request
## What does this MR do?
Adds a new line above the "Closes" message on a merge request.
## Why was this MR needed?
Autoappended `Closes` to the end of merge request needs a new line in the beginning. When using descriptive commit messages and the commit message body is used for the body of the merge request the Closes message should appear on a line by itself.
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
## What are the relevant issue numbers?
#21710
See merge request !6151
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/services/merge_requests/build_service.rb | 2 | ||||
-rw-r--r-- | spec/services/merge_requests/build_service_spec.rb | 4 |
3 files changed, 4 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index c506c0b9272..3deb6d77ec3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 8.12.0 (unreleased) + - Prepend blank line to `Closes` message on merge request linked to issue (lukehowell) - Filter tags by name !6121 - Make push events have equal vertical spacing. - Add two-factor recovery endpoint to internal API !5510 diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index 290742f1506..e57791f6818 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -83,7 +83,7 @@ module MergeRequests closes_issue = "Closes ##{iid}" if merge_request.description.present? - merge_request.description += closes_issue.prepend("\n") + merge_request.description += closes_issue.prepend("\n\n") else merge_request.description = closes_issue end diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb index 232508cda23..0d586e2216b 100644 --- a/spec/services/merge_requests/build_service_spec.rb +++ b/spec/services/merge_requests/build_service_spec.rb @@ -99,14 +99,14 @@ describe MergeRequests::BuildService, services: true do let(:source_branch) { "#{issue.iid}-fix-issue" } it 'appends "Closes #$issue-iid" to the description' do - expect(merge_request.description).to eq("#{commit_1.safe_message.split(/\n+/, 2).last}\nCloses ##{issue.iid}") + expect(merge_request.description).to eq("#{commit_1.safe_message.split(/\n+/, 2).last}\n\nCloses ##{issue.iid}") end context 'merge request already has a description set' do let(:description) { 'Merge request description' } it 'appends "Closes #$issue-iid" to the description' do - expect(merge_request.description).to eq("#{description}\nCloses ##{issue.iid}") + expect(merge_request.description).to eq("#{description}\n\nCloses ##{issue.iid}") end end |