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
end
def cherry_pick_description(start_branch_name)
if merge_commit?
message_buffer = ""
message_buffer = "(cherry picked from commit #{sha})"
if merge_commit?
compare = CompareService.new(project, sha).execute(project, start_branch_name)
*commits_in_merge, merge_commit = compare.commits
message_buffer << "cherry picked from merge #{merge_commit.sha}"
# Ignore the merge commit.
commits_in_merge = compare.commits[0..-2]
if commits_in_merge.present?
message_buffer << "; commits:"
message_buffer << "\n"
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
message_buffer
else
"cherry picked from commit #{sha}"
end
message_buffer
end
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