From b9116aa0d8779fdbce5f00c6668f284e64521ad0 Mon Sep 17 00:00:00 2001
From: Akhmetchanov Pavel Aleksandrovich
Date: Mon, 11 May 2020 15:05:56 +0300
Subject: [PATCH] changed pre-commit for save a number of the issue into
commit-message
---
tools/prepare-commit-message.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/prepare-commit-message.sh b/tools/prepare-commit-message.sh
index e900ab1..4e29550 100644
--- a/tools/prepare-commit-message.sh
+++ b/tools/prepare-commit-message.sh
@@ -3,16 +3,18 @@
set -- $HUSKY_GIT_PARAMS
BRANCH_NAME=$(git symbolic-ref --short HEAD)
+# sample "19_blure_sensitive_text" -> "19"
+BRANCH_NAME_ID_ISSUE=$(git symbolic-ref --short HEAD | sed -e 's/\([0-9]*\)[^0-9]*/\1/')
BRANCH_IN_COMMIT=0
if [ -f $1 ]; then
BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1)
fi
-if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
+if [ -n "$BRANCH_NAME_ID_ISSUE" ] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
if [ -f $1 ]; then
BRANCH_NAME="${BRANCH_NAME/\//\/}"
- sed -i.bak -e "1s@^@[$BRANCH_NAME] @" $1
+ sed -i.bak -e "1s@^@[#$BRANCH_NAME_ID_ISSUE] @" $1
else
echo "[$BRANCH_NAME] " > "$1"
fi