diff options
author | Maarten Aertsen <maarten@nlnetlabs.nl> | 2024-02-27 22:39:57 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-02-29 00:04:21 +0100 |
commit | 65571b67d7d310089e40d13f26b06cfcb85465bb (patch) | |
tree | f6b8baf64db511ac11eeb10d2c4d0654d71a0447 /contrib/commit-msg | |
parent | 8ba852ea7a3a20634f6866c32231a7e1409077cf (diff) | |
download | aerc-65571b67d7d310089e40d13f26b06cfcb85465bb.tar.gz |
contrib: use sed -E for shell scripts
The + character is not part of the 'basic regular expressions' in BSD
grep. Use -E to enable extended (modern) regular expressions. Also
remove escaping. This makes the commit msg hook work on macOS 14.2.
Signed-off-by: Maarten Aertsen <maarten@nlnetlabs.nl>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'contrib/commit-msg')
-rwxr-xr-x | contrib/commit-msg | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/commit-msg b/contrib/commit-msg index add67177..503b5a11 100755 --- a/contrib/commit-msg +++ b/contrib/commit-msg @@ -41,7 +41,7 @@ while read -r key value; do key="$first_letter$other_letters" # Find sort order of this key. - order=$(echo "$trailer_order" | grep -Fxn "$key" | sed -n 's/^\([0-9]\+\):.*/\1/p') + order=$(echo "$trailer_order" | grep -Fxn "$key" | sed -nE 's/^([0-9]+):.*/\1/p') if [ -z "$order" ]; then echo "warning: unknown trailer '$key'" >&2 # Unknown trailers are always first. @@ -51,7 +51,7 @@ while read -r key value; do echo "$order $key $value" done | # Sort trailers according to their numeric order, trim the numeric order. -LC_ALL=C sort -n | sed 's/^[0-9]\+ //' > "$tmp" +LC_ALL=C sort -n | sed -E 's/^[0-9]+ //' > "$tmp" debug echo ==== sanitized trailers ==== debug cat "$tmp" |