Commit 3d7febc0 authored by Saverio Miroddi's avatar Saverio Miroddi

Extracted cherry-pick description in ::Commit

This also fixes the inconsistency between non/merge commits in the number of newlines introduced.
parent cd80a907
......@@ -251,15 +251,15 @@ class Commit
project.repository.next_branch("cherry-pick-#{short_id}", mild: true)
end
def cherry_pick_message(start_branch_name)
message_buffer = message.dup
def cherry_pick_description(start_branch_name)
if merge_commit?
message_buffer = ""
compare = CompareService.new(project, sha).execute(project, start_branch_name)
*commits_in_merge, merge_commit = compare.commits
message_buffer << "\n\ncherry picked from merge #{merge_commit.sha}"
message_buffer << "cherry picked from merge #{merge_commit.sha}"
if commits_in_merge.present?
message_buffer << "; commits:"
......@@ -268,11 +268,15 @@ class Commit
message_buffer << "\n- #{commit_in_merge.sha}"
end
end
message_buffer
else
message_buffer << "\ncherry picked from commit #{sha}"
"cherry picked from commit #{sha}"
end
end
message_buffer
def cherry_pick_message(start_branch_name)
%Q{#{message}\n\n#{cherry_pick_description(start_branch_name)}}
end
def revert_description(user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment