e2c73cf59a1a02257203db784f1e2fd27c830173

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

fix(changelog): allow breaking change message to span multiple lines

This also allows the option to put extra paragraphs after the BREAKING CHANGE
message while properly displaying the breaking change message. Useful, for
example, to add signed-off or co-authored lines.

Diff

 1diff --git a/tools/changelog.sh b/tools/changelog.sh
 2index 845b1d4b406ff46dca7dadeddb203e319996cc20..8753212e96bca5157c03e68947c7b100c4907cce 100755
 3--- a/tools/changelog.sh
 4+++ b/tools/changelog.sh
 5@@ -86,11 +86,15 @@ function parse-commit {
 6 
 7   # Return subject if the body or subject match the breaking change format
 8   function commit:is-breaking {
 9-    local subject="$1" body="$2"
10+    local subject="$1" body="$2" message
11 
12     if [[ "$body" =~ "BREAKING CHANGE: (.*)" || \
13       "$subject" =~ '^[^ :\)]+\)?!: (.*)$' ]]; then
14-      echo "${match[1]}"
15+      message="${match[1]}"
16+      # skip next paragraphs (separated by two newlines or more)
17+      message="${message%%$'\n\n'*}"
18+      # ... and replace newlines with spaces
19+      echo "${message//$'\n'/ }"
20     else
21       return 1
22     fi