2011-12-20 08:16:08 -06:00
|
|
|
#!/bin/sh
|
|
|
|
TOPDIR=`pwd`
|
|
|
|
USERNAME=$1
|
|
|
|
|
|
|
|
if [ "x$1" = "x" ] ; then
|
|
|
|
echo "Usage: $0 <Username>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
add_remote()
|
|
|
|
{
|
|
|
|
remote_exist=`grep remote .git/config | grep review | wc -l`
|
|
|
|
if [ "x$remote_exist" = "x0" ] ; then
|
2021-08-26 04:41:35 -05:00
|
|
|
git remote add review ssh://$USERNAME@review.openocd.org:29418/openocd.git
|
2018-12-17 08:00:16 -06:00
|
|
|
git config remote.review.push HEAD:refs/for/master
|
2011-12-20 08:16:08 -06:00
|
|
|
else
|
|
|
|
echo "Remote review exists"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
update_commit_msg()
|
|
|
|
{
|
2012-05-29 11:41:02 -05:00
|
|
|
cd "${TOPDIR}/.git/hooks"
|
2011-12-20 08:16:08 -06:00
|
|
|
save_file=commit-msg-`date +%F-%T`
|
|
|
|
mv commit-msg $save_file
|
|
|
|
printf "%-30s" "Updating commit-msg"
|
|
|
|
status="OK"
|
2021-08-26 04:41:35 -05:00
|
|
|
wget -o log https://review.openocd.org/tools/hooks/commit-msg || status="FAIL"
|
2011-12-20 08:16:08 -06:00
|
|
|
echo $status
|
|
|
|
if [ $status = "FAIL" ] ; then
|
|
|
|
mv $save_file commit-msg
|
|
|
|
fi
|
|
|
|
chmod a+x commit-msg
|
|
|
|
}
|
|
|
|
|
|
|
|
add_remote
|
|
|
|
update_commit_msg
|