aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKate Ward <kate.ward@forestent.com>2020-04-12 14:02:13 +0200
committerKate Ward <kate.ward@forestent.com>2020-04-12 14:02:13 +0200
commita44e8f3923bdedefc2a2ceac837f27332feabcca (patch)
treecb0ca35d82984a2ed2e9864fec71cce7fa4fbc23
parent4bfa9834c6f1f04cda08cdd68752516ca762f008 (diff)
downloadshflags-a44e8f3923bdedefc2a2ceac837f27332feabcca.tar.gz
Fixed handling of deleted files.
-rwxr-xr-x.githooks/pre-commit.shellcheck5
1 files changed, 5 insertions, 0 deletions
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}" ;;