homesync/.githooks/pre-commit

14 lines
230 B
Plaintext
Raw Normal View History

#!/bin/bash
set -e
filesToFormat=$(
git --no-pager diff --name-status --no-color --cached | \
2022-01-12 11:02:49 +00:00
awk '$1 != "D" && $2 ~ /\.rs/ {print $NF}'
)
for path in $filesToFormat
do
rustfmt --edition 2021 $path
git add $path
done;