From caa1c0dfd81c78917f11cdac83cea6fa4aafc701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 9 Aug 2023 15:16:35 +0200 Subject: [PATCH] pre-commit: fix weird bug where commit_files is undefined in bash --- scripts/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pre-commit b/scripts/pre-commit index e2410448..61b1010e 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -18,7 +18,7 @@ log() { } # If the commit has no files, skip everything as there is nothing to format -if [[ ${#commit_files} = 0 ]]; then +if [[ -z ${commit_files+x} ]] || [[ ${#commit_files} = 0 ]]; then log "no files to format" exit 0 fi