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 ...@@ -251,15 +251,15 @@ class Commit
project.repository.next_branch("cherry-pick-#{short_id}", mild: true) project.repository.next_branch("cherry-pick-#{short_id}", mild: true)
end end
def cherry_pick_message(start_branch_name) def cherry_pick_description(start_branch_name)
message_buffer = message.dup
if merge_commit? if merge_commit?
message_buffer = ""
compare = CompareService.new(project, sha).execute(project, start_branch_name) compare = CompareService.new(project, sha).execute(project, start_branch_name)
*commits_in_merge, merge_commit = compare.commits *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? if commits_in_merge.present?
message_buffer << "; commits:" message_buffer << "; commits:"
...@@ -268,11 +268,15 @@ class Commit ...@@ -268,11 +268,15 @@ class Commit
message_buffer << "\n- #{commit_in_merge.sha}" message_buffer << "\n- #{commit_in_merge.sha}"
end end
end end
message_buffer
else else
message_buffer << "\ncherry picked from commit #{sha}" "cherry picked from commit #{sha}"
end end
end
message_buffer def cherry_pick_message(start_branch_name)
%Q{#{message}\n\n#{cherry_pick_description(start_branch_name)}}
end end
def revert_description(user) 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