numam-spdk/.githooks/pre-commit
John Meneghini 22898a91b9 git: add .githooks to repository
- Add git pre-commit and pre-push hooks
 - To enable type 'git config core.hooksPath .githooks'
 - For for additional example hooks see the .git/hooks directory

Change-Id: I92155f4083c8547759bfbbfe4df64923548fa4d5
Signed-off-by: Ed Rodriguez <ed.rodriguez@netapp.com>
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/409577
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-05-04 22:17:35 +00:00

29 lines
743 B
Bash
Executable File

#!/bin/sh
#
# 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.
rc=0
# Redirect output to stderr.
exec 1>&2
# If there are formatting errors, print the offending file names and fail.
if [ -x "./scripts/check_format.sh" ]; then
echo "Running check_format.sh ..."
"./scripts/check_format.sh" > check_format.log 2>&1
rc=$?
if [ $rc -ne 0 ]; then
cat check_format.log
echo ""
echo "ERROR check_format.sh returned errors!"
echo "ERROR Fix the problem and use 'git add' to update your changes."
echo "ERROR See `pwd`/check_format.log for more information."
echo ""
fi
fi
exit $rc