3 # Copy me to .git/hooks/pre-commit
9 if [[ "$tmpdir" && -e "$tmpdir" ]];then
13 trap cleanup_tmpdir EXIT
15 # Check out the git index (what's about to be committed) in a temporary
16 # directory & run the supplied command there.
17 in_git_index_in_tmpdir
() {
19 [[ "$tmpdir" && -d "$tmpdir" ]]
20 start_index
=$(sha256sum "${GIT_INDEX_FILE:-.git/index}")
21 git checkout
-index --prefix="$tmpdir/" -a
25 end_index
=$(sha256sum "${GIT_INDEX_FILE:-.git/index}")
26 if [[ "$start_index" != "$end_index" ]];then
27 echo "Index changed while pre-commit tests were running. Aborting!"
34 cargo clippy
-- -D warnings
-W clippy
::pedantic
35 rustfmt
--check src
/*.rs
38 in_git_index_in_tmpdir verify