The repository path is shell-quoted (printf %q) where it is written into the installed hooks, so a path with spaces, quotes or $(...) is data. The local core.hooksPath values are read with -z and compared and restored element by element, so a value with a newline survives; the loop avoids mapfile. Any local value, including an empty or trailing empty one, is lifted for the install and restored. tests/scripts/test_dev_setup.py covers it with stub tools in throwaway repositories, and lint.yml now runs tests/scripts. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm