Skip to content

Commit f349ca0

Browse files
committed
shell script 업데이트
1 parent b59300b commit f349ca0

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

gitlab/prepare-commit-msg.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
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+
210
if [ -z "$BRANCHES_TO_SKIP" ]; then
3-
BRANCHES_TO_SKIP=(master develop release hotfix)
11+
BRANCHES_TO_SKIP=(master develop release hotfix)
412
fi
513
614
BRANCH_NAME=$(git symbolic-ref --short HEAD)
715
BRANCH_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]+'`
917
COMMIT_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
1634
if [ -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
1936
fi
2037
```
2138

0 commit comments

Comments
 (0)