summaryrefslogtreecommitdiff
path: root/tools/changelog.sh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-12-12 14:22:26 +0100
committerMarc Cornellà <marc.cornella@live.com>2020-12-12 14:22:26 +0100
commite2c73cf59a1a02257203db784f1e2fd27c830173 (patch)
tree11a77ee101ece81f76c2160f1d347d99faae7c3e /tools/changelog.sh
parente8e37eedbc8cf5e446be11971769df7cc10faeb0 (diff)
downloadzsh-e2c73cf59a1a02257203db784f1e2fd27c830173.tar.gz
zsh-e2c73cf59a1a02257203db784f1e2fd27c830173.tar.bz2
zsh-e2c73cf59a1a02257203db784f1e2fd27c830173.zip
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.
Diffstat (limited to 'tools/changelog.sh')
-rwxr-xr-xtools/changelog.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/changelog.sh b/tools/changelog.sh
index 845b1d4b4..8753212e9 100755
--- a/tools/changelog.sh
+++ b/tools/changelog.sh
@@ -86,11 +86,15 @@ function parse-commit {
# Return subject if the body or subject match the breaking change format
function commit:is-breaking {
- local subject="$1" body="$2"
+ local subject="$1" body="$2" message
if [[ "$body" =~ "BREAKING CHANGE: (.*)" || \
"$subject" =~ '^[^ :\)]+\)?!: (.*)$' ]]; then
- echo "${match[1]}"
+ message="${match[1]}"
+ # skip next paragraphs (separated by two newlines or more)
+ message="${message%%$'\n\n'*}"
+ # ... and replace newlines with spaces
+ echo "${message//$'\n'/ }"
else
return 1
fi