Files
gitHooks/pre-commit
T
Marc BARBIER 124f952b10 fix color
2021-06-29 10:00:59 +02:00

32 lines
650 B
Bash
Executable File

#!/bin/bash
BOLD=`tput bold`
RED=`tput setaf 1`
GREEN=`tput setaf 2`
GREENBOLD=$BOLD$GREEN
REDBOLD=$BOLD$RED
RESET=`tput init`
git diff --staged | grep -v ^- | grep "console.log" 2> /dev/null 1> /dev/null
if [ $? = 0 ]
then
echo "${REDBOLD}/!\\Console.log detected /!\\"
echo "${REDBOLD}aborting..."
exit 1
else
echo "${GREENBOLD} No console.log"
fi
git diff --staged | grep -v ^- | grep "<<<<<<< HEAD" 2> /dev/null 1> /dev/null
if [ $? = 0 ]
then
echo "${REDBOLD}/!\\ UNRESOLVED MERGE DETECTED /!\\"
echo "${REDBOLD}aborting..."
exit 1
else
echo "${GREENBOLD} No unresolved merge"
fi
echo $RESET