From 4ce0e2377f74d5986da0b83af6ef3cc4e9d0b8c0 Mon Sep 17 00:00:00 2001 From: dark64 Date: Thu, 28 May 2020 12:04:04 +0200 Subject: [PATCH] precommit - exclude deleted files on git diff --- .githooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 7b82f95f..74a2b3f2 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -12,7 +12,7 @@ fi files=() -for file in $(git diff --name-only --cached); do +for file in $(git diff --diff-filter=d --name-only --cached); do if [ ${file: -3} == ".rs" ]; then rustfmt +nightly --check $file &>/dev/null if [ $? != 0 ]; then