From 616f5820ef3a8a20b872e8938e3274f0c329ffba Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 28 Aug 2023 23:42:14 +0900 Subject: git:hooks: improve githooks/commit-msg --- githooks/commit-msg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'githooks/commit-msg') 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}" -- cgit v1.2.3-70-g09d2