1dba1120410280699c6a97a5252bab24681b46b8

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(changelog): fix for `${(@ps:$sep:)var}` construct in zsh < 5.0.8

In recent zsh versions, `${(@ps:$sep:)var}` where $sep is a variable containing
a separator string and $var is a string with multiple values separated by $sep,
the `p` flag makes zsh correctly expand $sep before splitting $var. In versions
older than 5.0.8, this doesn't happen, so we use `eval` to get the same effect.

Diff

 1diff --git a/tools/changelog.sh b/tools/changelog.sh
 2index e32d503b17abc7f288b422a169cd4946835843c9..664f346081b2441b047f08d400b4c497deb653e9 100755
 3--- a/tools/changelog.sh
 4+++ b/tools/changelog.sh
 5@@ -428,7 +428,7 @@ function main {
 6     fi
 7 
 8     # Read the commit fields (@ is needed to keep empty values)
 9-    raw_fields=("${(@ps:$SEP:)raw_commit}")
10+    eval "raw_fields=(\"\${(@ps:$SEP:)raw_commit}\")"
11     hash="${raw_fields[1]}"
12     refs="${raw_fields[2]}"
13     subject="${raw_fields[3]}"