1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-22 23:51:39 +03:00

devos: Fix editorconfig Git hook when no files are changed

It is possible to make a commit with no files, e.g. with `--allow-empty`
or `--only` flags to `git-commit`. Previously, this hook would hang
indefinitely in those cases as `editorconfig-checker` with no file
arguments will read from stdin.
This commit is contained in:
Andrew Marshall 2022-07-21 09:12:06 -04:00
parent 34cb98601d
commit dd51f64bc5

View File

@ -20,7 +20,10 @@ if (( ${#nix_files[@]} != 0 )); then
fi fi
# check editorconfig # check editorconfig
editorconfig-checker -- "${all_files[@]}" if (( ${#all_files[@]} != 0 )); then
editorconfig-checker -- "${all_files[@]}"
fi
if [[ $? != '0' ]]; then if [[ $? != '0' ]]; then
printf "%b\n" \ printf "%b\n" \
"\nCode is not aligned with .editorconfig" \ "\nCode is not aligned with .editorconfig" \