diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 391656318940d23b51b226c8368c7332a2af911b..da7aebd944f48f1de664ae3191d2da7494c67b44 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -214,8 +214,8 @@ class MergeRequest < ActiveRecord::Base self.merge end - def automerge!(current_user, merge_commit_message = nil) - if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(merge_commit_message) && self.unmerged_commits.empty? + def automerge!(current_user, commit_message = nil) + if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(commit_message) && self.unmerged_commits.empty? self.merge!(current_user.id) true end @@ -322,9 +322,10 @@ class MergeRequest < ActiveRecord::Base def merge_commit_message message = "Merge branch '#{source_branch}' into '#{target_branch}'" message << "\n\n" - message << title + message << title.to_s message << "\n\n" - message << description + message << description.to_s + message end private diff --git a/spec/controllers/merge_requests_controller_spec.rb b/spec/controllers/merge_requests_controller_spec.rb index 69708edd8b100e1a0df6b0fd620520a7fcee3950..f237f358452b8a9bcdc4ecf11d2017c435efd2f2 100644 --- a/spec/controllers/merge_requests_controller_spec.rb +++ b/spec/controllers/merge_requests_controller_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Projects::MergeRequestsController do let(:project) { create(:project_with_code) } let(:user) { create(:user) } - let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project, target_branch: "bcf03b5d~3", source_branch: "bcf03b5d") } + let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project, target_branch: "stable", source_branch: "master") } before do sign_in(user) @@ -61,7 +61,7 @@ describe Projects::MergeRequestsController do it "should really be a git email patch with commit" do get :show, project_id: project.to_param, id: merge_request.iid, format: format - expect(response.body[0..100]).to start_with("From #{merge_request.commits.last.id}") + expect(response.body[0..100]).to start_with("From 6ea87c47f0f8a24ae031c3fff17bc913889ecd00") end it "should contain git diffs" do