Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 67 lines (49 sloc) 1.29 KB
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
msg=$(cat $1)
echo "msg is: $msg"
if [[ $msg == \[*\]* ]]; then
### 说明判断 start
isRightKey=false
# 功能
if [[ $msg == *Feature* ]]; then
isRightKey=true
echo "Feature "
fi
# bug
if [[ $msg == *Fix* ]]; then
isRightKey=true
echo "Fix "
fi
# 修改
if [[ $msg == *Modify* ]]; then
isRightKey=true
echo "Modify"
fi
echo "result $isRightKey"
if $isRightKey ; then
echo "$msg is right "
exit 0
else
echo "$msg need tag -> [Modify]/[Feature]/[Fix] "
exit 1
fi
### 说明判断 end
else
echo "$msg does NOT contain [] "
exit 1
fi
You can’t perform that action at this time.