Files
Sourcetrail/setup/git/git_pre_commit_hook.sh
T
Andreas Stallinger d431161fbb script: test enforced push to master
enforced building and test with a pre-push hook
IMPORTANT: cmake is needed in PATH
2016-03-07 16:58:57 +01:00

28 lines
464 B
Bash
Executable File

#!/bin/bash
ABORT="\033[31mAbort:\033[00m"
SUCCESS="\033[32mSuccess:\033[00m"
INFO="\033[33mInfo:\033[00m"
BRANCH_NAME=$(git symbolic-ref -q --short HEAD)
if [ -z $BRANCH_NAME ]
then
echo -e $ABORT "You are not on any branch."
exit 1
fi
if [ $BRANCH_NAME == "master" ]
then
echo -e $ABORT "Commiting to master is prohibited."
exit 1
fi
if [ $BRANCH_NAME == "public_beta" ]
then
echo -e $ABORT "Commiting to public_beta is prohibited."
exit 1
fi
exit 0