From 448250ff571d442d4608e0d7a8550c66cbe1bc2b Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 21 Jun 2024 00:54:22 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20misc(pre-commit=20hook):=20handl?= =?UTF-8?q?e=20filenames=20with=20spaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .githooks/pre-commit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 8e028c1..e5f27c4 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -149,11 +149,11 @@ fi ################################################################## # Get the newly added and modified files. -all_changed_files=$(git diff --cached --name-only --diff-filter=AM) +mapfile -t all_changed_files < <(git diff --cached --name-only) script_name=$(basename "$0") # Loop through all newly added or modified files. -for file in $all_changed_files; do +for file in "${all_changed_files[@]}"; do file_name=$(basename "$file") # Ignore this script and the changelog.