aboutsummaryrefslogtreecommitdiffhomepage
path: root/githooks/commit-msg
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-08-28 23:42:14 +0900
committernsfisis <nsfisis@gmail.com>2023-08-28 23:42:14 +0900
commit616f5820ef3a8a20b872e8938e3274f0c329ffba (patch)
tree2e5a04ea1537bef98f64a0e9c0dfeee058007041 /githooks/commit-msg
parent2518a661986646b3a9b3f549a3a5514571948030 (diff)
downloaddotfiles-616f5820ef3a8a20b872e8938e3274f0c329ffba.tar.gz
dotfiles-616f5820ef3a8a20b872e8938e3274f0c329ffba.tar.zst
dotfiles-616f5820ef3a8a20b872e8938e3274f0c329ffba.zip
git:hooks: improve githooks/commit-msg
Diffstat (limited to 'githooks/commit-msg')
-rwxr-xr-xgithooks/commit-msg6
1 files changed, 3 insertions, 3 deletions
diff --git a/githooks/commit-msg b/githooks/commit-msg
index 67b883f..c25b0a0 100755
--- a/githooks/commit-msg
+++ b/githooks/commit-msg
@@ -125,12 +125,12 @@ if [[ -z ${gitbranch} ]]; then
fi
# Extract issue number from branch name.
-local issue_number="$(echo "${gitbranch}" | grep -o '[0-9][0-9]*' | head -1)"
+local issue_number="$(git extract-issue "${gitbranch}")"
if [[ -z ${issue_number} ]]; then
# Failed to extract. Leave the commit message as it is.
return 0
fi
-# Substitute '###' with '#NNNNN', where 'NNNNN' is the issue number.
+# Substitute '###'.
# '$1' is passed by Git, the file name that holds commit message.
-sed -i '' -e "s|###|#${issue_number}|g" "${1}"
+sed -i '' -e "s|###|${issue_number}|g" "${1}"