pre-commit hook: fix shellcheck SC2207

Prefer mapfile or read -a to split command output

https://github.com/koalaman/shellcheck/wiki/SC2207
This commit is contained in:
teutat3s 2022-04-09 15:22:37 +02:00
parent a1c87c43ca
commit 7ecfcf5814
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1

View file

@ -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