Files
tarpc/hooks/pre-push

29 lines
461 B
Bash
Executable File

#!/bin/sh
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
git diff --exit-code &>/dev/null
if [ "$?" != 0 ];
then
echo ${RED}ERROR${NC} You have uncommitted changes please commit or stash them before pushing.
exit 1
fi
TEST_RESULT=0
cargo test &>/dev/null
if [ "$?" != "0" ];
then
echo ${RED}FAIL${NC} pre-push test check
TEST_RESULT=1
else
echo ${GREEN}PASS${NC} pre-push test check
fi
if [ "$TEST_RESULT" == "1" ];
then
exit 1
fi
exit 0