A small, fast, drop-in replacement for git-hooks.nix

fix: skip empty files list even if regex matches empty string #18

Merged poacher.dev
targeting main
Merged opened by and assigned to poacher.dev
targeting main

When NIXHOOKS_FILES is empty:

printf '%s\0' "${NIXHOOKS_FILES[@]}" |
  { grep -zE -- "$files_re" || true; } >"$cache_file"

printf will print an empty string, and the pattern .* will match it, running the program with an empty string argument even if always_run is false.

This patch avoids this by special casing the empty NIXHOOKS_FILES case.

This pull request has no versions submitted yet.