rootvector2's Description of Work
npm patch update rebases the existing patch in a throwaway git repo. #rebasePatch extracts the base and target dependency versions with pacote and copies each tree into that repo with fs.cp. pacote keeps a tarball's own .git/ on extract, so a dependency can ship an executable .git/hooks/pre-commit (or a .git/config with core.fsmonitor) that the copy lays over the work repo, and the git add/git commit right after run it. A publisher of a package you patch then gets code execution the moment you run npm patch update on it, with no install-script prompt in the path.
The copy that goes the other way (repo into the edit dir) already filters .git with notGitDir; the two copies into the repo did not. Pass the same filter to both so a tarball's .git never reaches the rebase repo.
Added a regression test that serves a 2.0.0 tarball carrying an executable pre-commit hook; it runs on the current tree and does not after the fix.