From 7ecfcf58140669879d0a35050de6406856f8d019 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 9 Apr 2022 15:22:37 +0200 Subject: [PATCH] pre-commit hook: fix shellcheck SC2207 Prefer mapfile or read -a to split command output https://github.com/koalaman/shellcheck/wiki/SC2207 --- shell/hooks/pre-commit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 985d3b40..5d8ba2df 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -10,8 +10,8 @@ fi diff="git diff-index --name-only --cached $against --diff-filter d" -nix_files=($($diff -- '*.nix')) -all_files=($($diff)) +mapfile -t nix_files < <($diff -- '*.nix') +mapfile -t all_files < <($diff) # Format staged nix files. if [[ -n "${nix_files[@]}" ]]; then