Install the EXIT/INT/TERM traps before core.hooksPath is lifted, make the restore idempotent, and save and restore every local value of a multi-valued setting in order. When a global or system value still applies after the local one is lifted, print the script's own message and exit 1 before pre-commit runs. Note that readlink -f/-m are GNU. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm