[#2] Fixed commit hook

This commit is contained in:
Jef Roosens 2021-04-02 14:45:04 +02:00
parent e2493e7b19
commit 0007652e68
Signed by: Jef Roosens
GPG key ID: B580B976584B5F30
2 changed files with 8 additions and 7 deletions

View file

@ -10,9 +10,10 @@ issue_num=`echo "$branch" | grep -Po '^[0-9]+(?=-)'`
if ! grep -q '([0-9]\+)$' "$1"; then
# Error out if we can't derive issue number
[[ -z "$issue_num" ]] && {
>&2 echo "Couldn't derive issue number from branch. Please add one manually."; exit 1;
>&2 echo "Couldn't derive issue number from branch. Please add one manually.";
exit 1;
}
# Append issue number
echo "(#$issue_num)" >> "$1"
# Append issue number, and remove all comments
echo "[#$issue_num]" "$(cat "$1")" > "$1"
fi