File tree Expand file tree Collapse file tree 1 file changed +26
-9
lines changed
Expand file tree Collapse file tree 1 file changed +26
-9
lines changed Original file line number Diff line number Diff line change 11```
2+ #!/usr/bin/env sh
3+ #. "$(dirname -- "$0")/_/husky.sh"
4+
5+
6+ COMMIT_MSG_FILE=$1
7+ COMMIT_SOURCE=$2
8+ SHA1=$3
9+
210if [ -z "$BRANCHES_TO_SKIP" ]; then
3- BRANCHES_TO_SKIP=(master develop release hotfix)
11+ BRANCHES_TO_SKIP=(master develop release hotfix)
412fi
513
614BRANCH_NAME=$(git symbolic-ref --short HEAD)
715BRANCH_NAME="${BRANCH_NAME##*/}"
8- JIRA_ID=`echo $BRANCH_NAME | egrep -o 'A .-[0-9]+'`
16+ JIRA_ID=`echo $BRANCH_NAME | egrep -o 'B .-[0-9]+'`
917COMMIT_SUBJECT=$(cat $1 |head -1)
10- #echo $COMMIT_SUBJECT
11- COMMIT_SUBJECT_NEW=$(printf "%s (%s)" "${COMMIT_SUBJECT}" "${JIRA_ID}")
12- #echo $COMMIT_SUBJECT_NEW
13- BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$")
14- BRANCH_IN_COMMIT=$(grep -c "$JIRA_ID" $1)
18+ COMMIT_SUBJECT_NEW=$(printf "%s (#%s)" "${COMMIT_SUBJECT}" "${JIRA_ID}")
19+
20+ {
21+ BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$")
22+ } ||
23+ {
24+ BRANCH_EXCLUDED=0
25+ }
26+
27+ {
28+ BRANCH_IN_COMMIT=$(grep -c "$JIRA_ID" $1)
29+ } ||
30+ {
31+ BRANCH_IN_COMMIT=0
32+ }
1533
1634if [ -n $JIRA_ID ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
17- echo "asdasdasd"
18- sed -i.bak -e "1s/.*/$COMMIT_SUBJECT_NEW /" $1
35+ sed -i.bak -e "1s/.*/$COMMIT_SUBJECT_NEW /" $1
1936fi
2037```
2138
You can’t perform that action at this time.
0 commit comments