add some hooks
This commit is contained in:
27
pre-receive-hook-taiga-check-num-issue.sh
Normal file
27
pre-receive-hook-taiga-check-num-issue.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
check_commit() {
|
||||
# check the log message for ticket number
|
||||
message=`git log --format=%s -1 $1`
|
||||
ticket=`echo "$message" | grep -o "TG-[0-9]\+"`
|
||||
if [ "$ticket" = "" ] ; then
|
||||
echo "The first line of the commit message $1 don't contain a Taiga issue number (TG-<issue number>)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
NULL_SHA1="0000000000000000000000000000000000000000" # 40 0's
|
||||
new_list=
|
||||
any_deleted=false
|
||||
while read oldsha newsha refname; do
|
||||
new_list="$new_list $newsha"
|
||||
done
|
||||
|
||||
git rev-list $new_list --not --all |
|
||||
while read sha1; do
|
||||
objtype=$(git cat-file -t $sha1)
|
||||
case $objtype in
|
||||
commit) check_commit $sha1;;
|
||||
esac
|
||||
done
|
||||
|
Reference in New Issue
Block a user