Commit e33608d8 authored by Saverio Miroddi's avatar Saverio Miroddi

Made commit cherry-pick message more standard

Follow the `cherry pick -x` format for the first line, and the
interactive rebase format for the commits in the merge, in case
of merge commit
parent 3d7febc0
...@@ -252,27 +252,24 @@ class Commit ...@@ -252,27 +252,24 @@ class Commit
end end
def cherry_pick_description(start_branch_name) def cherry_pick_description(start_branch_name)
if merge_commit? message_buffer = "(cherry picked from commit #{sha})"
message_buffer = ""
if merge_commit?
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 # Ignore the merge commit.
commits_in_merge = compare.commits[0..-2]
message_buffer << "cherry picked from merge #{merge_commit.sha}"
if commits_in_merge.present? if commits_in_merge.present?
message_buffer << "; commits:" message_buffer << "\n"
commits_in_merge.each do |commit_in_merge| commits_in_merge.each do |commit_in_merge|
message_buffer << "\n- #{commit_in_merge.sha}" message_buffer << "\n#{commit_in_merge.short_id} #{commit_in_merge.title}"
end end
end end
message_buffer
else
"cherry picked from commit #{sha}"
end end
message_buffer
end end
def cherry_pick_message(start_branch_name) def cherry_pick_message(start_branch_name)
......
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