occlum/.githooks/post-commit
2019-08-28 06:32:50 +00:00

21 lines
432 B
Bash
Executable File

#!/bin/bash
cd src/libos
output=$(cargo fmt --all -- --check 2>&1)
retval=$?
if [[ $retval -eq 0 ]]
then
exit 0
elif [[ $retval -eq 1 ]]
then
echo "Rust format suggestsions (generated by \`cd src/libos && cargo fmt --all -- --check\`):"
echo
echo "$output"
echo
echo "To get rid of the format warnings above, run \`cargo fmt\` before the next commit."
exit 1
else
echo "Warning: \`cargo fmt\` is not available."
exit 1
fi