aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-06-24 11:39:04 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2022-06-27 21:13:44 +0200
commit958ca3c1b471aab95e32c1e095d836206e845aa1 (patch)
tree4fed3fcbad6f989612708e34fbb53ed3d3de0c57
parentb7b90ddea0a9df8d9c322538bb028abf1efd306b (diff)
downloadpw-958ca3c1b471aab95e32c1e095d836206e845aa1.tar.gz
pw-apply: Trim hyphens
Looks like I hit the same issue as Paolo but he was more diligent sending his solution upstream. I like mine more :) Instead of having two magic ifs trim the leading and trailing hyphens with sed. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rwxr-xr-xpw-apply5
1 files changed, 2 insertions, 3 deletions
diff --git a/pw-apply b/pw-apply
index 350a819..36f8c45 100755
--- a/pw-apply
+++ b/pw-apply
@@ -38,9 +38,8 @@ get_cover()
sed -e 's/ *\[.*\] *//g' |
tr '[:upper:]' '[:lower:]' |
tr -d '\n' |
- tr -cs '[:alnum:]_-' '-')
- [ -n "$branch" -a ${branch:0:1} == '-' ] && branch=${branch:1}
- [ -n "$branch" -a ${branch: -1} == '-' ] && branch=${branch:: -1}
+ tr -cs '[:alnum:]_-' '-' |
+ sed -e 's/^-*\(.*[^-]\)-*$/\1/g')
cover_msgid=$(echo "$cover_json" | jq -r '.msgid' | tr -d '<>')
}