summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaverio Miroddi <saverio.pub2@gmail.com>2017-08-15 19:57:40 +0200
committerSaverio Miroddi <saverio.pub2@gmail.com>2017-08-15 19:57:40 +0200
commite33608d8e4367a04d855d047aceb65a927b3d8d8 (patch)
tree2f35269ac95ce9dcac82c951351df6d0c71946e1
parent3d7febc01c98baaeb6c937fa63d2bf23681cc8d2 (diff)
downloadgitlab-ce-e33608d8e4367a04d855d047aceb65a927b3d8d8.tar.gz
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
-rw-r--r--app/models/commit.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 9b5f3212bf3..314004ae58a 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -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)