2012-08-10 03:42:18 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Our "pre-commit" hook.
|
|
|
|
|
|
|
|
# save current config
|
|
|
|
echo "\n\nSaving current config\n\n"
|
|
|
|
cp config.status tmp.status
|
2013-04-12 23:19:46 +04:00
|
|
|
cp cyassl/options.h tmp.options.h
|
2012-08-10 03:42:18 +04:00
|
|
|
|
|
|
|
# stash modified files not part of this commit, don't test them
|
|
|
|
echo "\n\nStashing any modified files not part of commit\n\n"
|
|
|
|
git stash -q --keep-index
|
|
|
|
|
|
|
|
# do the commit tests
|
|
|
|
echo "\n\nRunning commit tests...\n\n"
|
2014-07-02 02:08:52 +04:00
|
|
|
./commit-tests.sh
|
|
|
|
RESULT=$?
|
2012-08-10 03:42:18 +04:00
|
|
|
|
|
|
|
# restore modified files not part of this commit
|
|
|
|
echo "\n\nPopping any stashed modified files not part of commit\n"
|
|
|
|
git stash pop -q
|
|
|
|
|
|
|
|
# restore current config
|
|
|
|
echo "\nRestoring current config\n"
|
|
|
|
mv tmp.status config.status
|
|
|
|
# don't show output incase error from above
|
|
|
|
./config.status >/dev/null 2>&1
|
2013-04-13 00:18:53 +04:00
|
|
|
mv tmp.options.h cyassl/options.h
|
2012-08-10 03:42:18 +04:00
|
|
|
make clean >/dev/null 2>&1
|
|
|
|
make -j 8 >/dev/null 2>&1
|
|
|
|
|
|
|
|
[ $RESULT -ne 0 ] && echo "\nOops, your commit failed\n" && exit 1
|
|
|
|
|
|
|
|
echo "\nCommit tests passed!\n"
|
|
|
|
exit 0
|