You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
760 B

  1. #!/bin/sh
  2. TOPDIR=`pwd`
  3. USERNAME=$1
  4. if [ "x$1" = "x" ] ; then
  5. echo "Usage: $0 <Username>"
  6. exit 1
  7. fi
  8. add_remote()
  9. {
  10. remote_exist=`grep remote .git/config | grep review | wc -l`
  11. if [ "x$remote_exist" = "x0" ] ; then
  12. git remote add review ssh://$USERNAME@openocd.zylin.com:29418/openocd.git
  13. git config remote.review.push HEAD:refs/for/master
  14. else
  15. echo "Remote review exists"
  16. fi
  17. }
  18. update_commit_msg()
  19. {
  20. cd ${TOPDIR}/.git/hooks
  21. save_file=commit-msg-`date +%F-%T`
  22. mv commit-msg $save_file
  23. printf "%-30s" "Updating commit-msg"
  24. status="OK"
  25. wget -o log http://openocd.zylin.com/tools/hooks/commit-msg || status="FAIL"
  26. echo $status
  27. if [ $status = "FAIL" ] ; then
  28. mv $save_file commit-msg
  29. fi
  30. chmod a+x commit-msg
  31. }
  32. add_remote
  33. update_commit_msg