diff --git a/setup/git/git_pre_push_hook.sh b/setup/git/git_pre_push_hook.sh index 8580e37c..c919054a 100755 --- a/setup/git/git_pre_push_hook.sh +++ b/setup/git/git_pre_push_hook.sh @@ -7,6 +7,9 @@ proteced_branches=("forced_tests" "master") #proteced_branch='master' current_branch=$(git symbolic-ref -q --short HEAD) +remote="$1" +url="$2" + FAIL="\033[31mFail:\033[00m" PASS="\033[32mPass:\033[00m" INFO="\033[33mInfo:\033[00m" @@ -73,6 +76,32 @@ function run_tests { cd $ROOTDIR } + +#handle delete remote branches +while read local_ref lorem_sha remote_ref remote_sha +do + if [ "$local_ref" == "(delete)" ] + then + if [ "$remote_ref" == "refs/heads/master" ] + then + echo "seriously dont delete the master" + exit 1 + else + echo "delete remote branch $remote_ref" + exit 0 + fi + fi +done + +# handle push --tags +while read -d $'\0' arg ; do + if [[ "$arg" == '--tags' ]] ; then + echo "pushing tags" + exit 0 + fi +done < /proc/$PPID/cmdline + + for branch in "${proteced_branches[@]}" do if [ $current_branch == $branch ]