diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-13 18:49:35 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-13 18:49:35 +0400 |
commit | d84b0fa6b5c84774e300e5fe6415defb30c441fe (patch) | |
tree | 9f4fe35898ef7b19cb01c751a961504f2deb97cb /lib | |
parent | 6a80083294bdd09f6e6d1d97a9512c434dc4e73d (diff) |
Add merge_commit_message argument for Satellite::MergeAction#merge
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/satellite/merge_action.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 4d8fd374a19..85615f282c4 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -24,10 +24,10 @@ module Gitlab # Returns false if the merge produced conflicts # Returns false if pushing from the satellite to the repository failed or was rejected # Returns true otherwise - def merge! + def merge!(merge_commit_message = nil) in_locked_and_timed_satellite do |merge_repo| prepare_satellite!(merge_repo) - if merge_in_satellite!(merge_repo) + if merge_in_satellite!(merge_repo, merge_commit_message) # push merge back to bare repo # will raise CommandFailed when push fails merge_repo.git.push(default_options, :origin, merge_request.target_branch) @@ -114,16 +114,11 @@ module Gitlab def merge_in_satellite!(repo, message = nil) update_satellite_source_and_target!(repo) - merge_message = "Merge branch '#{merge_request.source_branch}' into '#{merge_request.target_branch}'" - - if message - merge_message << "\n\n" - merge_message << message - end + message ||= "Merge branch '#{merge_request.source_branch}' into '#{merge_request.target_branch}'" # merge the source branch into the satellite # will raise CommandFailed when merge fails - repo.git.merge(default_options({no_ff: true}), "-m #{merge_message}", "source/#{merge_request.source_branch}") + repo.git.merge(default_options({no_ff: true}), "-m #{message}", "source/#{merge_request.source_branch}") rescue Grit::Git::CommandFailed => ex handle_exception(ex) end |