diff options
Diffstat (limited to 'rust/vendor/bendy/githooks/pre-commit/rustfmt-up-to-date')
-rwxr-xr-x | rust/vendor/bendy/githooks/pre-commit/rustfmt-up-to-date | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/vendor/bendy/githooks/pre-commit/rustfmt-up-to-date b/rust/vendor/bendy/githooks/pre-commit/rustfmt-up-to-date new file mode 100755 index 0000000..e408b24 --- /dev/null +++ b/rust/vendor/bendy/githooks/pre-commit/rustfmt-up-to-date @@ -0,0 +1,13 @@ +#!/bin/bash +set -euo pipefail + +EXPORT_DIR="$(mktemp -d --tmpdir= rustfmt-hook.XXXXXXX)" +# Cleanup temp dir on exit +trap '{ rm -rf "${EXPORT_DIR}"; }' EXIT + +git checkout-index -a --prefix="${EXPORT_DIR}/" +cd "${EXPORT_DIR}" + +# Nightly version is pinned to avoid untracable version clashes. +# Update from time to time manually or if any error is encounterd. +cargo +nightly fmt -- --check |