OpenDroneMap-ODM/hooks/pre-commit

24 wiersze
668 B
Bash

#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
exec 1>&2
echo "RUNNING PRE-COMMIT"
EXIT_CODE=0
# Get list of files about to be committed
if git diff --cached --name-only --diff-filter=ACM | grep 'ccd_defs.json'; then
echo "We changed ccd_defs.json"
GIT_ROOT=$(git rev-parse --show-toplevel)
python $GIT_ROOT/ccd_defs_check.py
EXIT_CODE=$(echo $?)
fi
# non-zero exit fails the commit
exit $EXIT_CODE