occlum/.githooks/post-commit
2020-10-14 20:34:12 +08:00

24 lines
393 B
Bash
Executable File

#!/bin/bash
if ! hash astyle; then
echo "Warning: \`astyle\` is not available."
exit 1
fi
cargo fmt --version >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo "Warning: \`cargo fmt\` is not available."
exit 1
fi
info=$(make format-check)
if [ -n "$info" ]; then
echo "Format Error detected:"
echo
echo "$info"
echo
echo "Please run \`make format\` before next commit."
echo
exit 1
fi