From e87aa62f8c86e133b388c3295027c4e67c9c24b1 Mon Sep 17 00:00:00 2001 From: Kate Ward Date: Sun, 12 Apr 2020 13:38:32 +0200 Subject: [PATCH] Handle deleted files properly. --- .githooks/pre-commit.shellcheck | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.githooks/pre-commit.shellcheck b/.githooks/pre-commit.shellcheck index 7615d44..f218922 100755 --- a/.githooks/pre-commit.shellcheck +++ b/.githooks/pre-commit.shellcheck @@ -22,6 +22,11 @@ fi success=${TRUE} for f in $(git diff --cached --name-only); do + # Check for file deletion. + if [ ! -r "${f}" ]; then + continue + fi + cmd=':' case "${f}" in shflags|shflags_test_helpers) cmd="shellcheck -s sh ${f}" ;;