-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lefthook is artificially slow when node_modules is not in the Git root #510
Comments
I haven't investigated the cause, but I've also been experiencing extremely long delays, oftentimes around 30 seconds per commit. I have not seen this issue when running git commands in an interactive shell, but it does occur when using Magit in Emacs. I don't know when this started exactly, but I would guess sometime in the past month or two – I had been using lefthook without issue before then. |
@montchr I don't know about OP's issue but yours is probably the same I encountered, and it's due to the As a workaround for Magit, setting |
Please, check out new versions (1.6.x) This issue must be fixed there |
🔧 Summary
On my team we have a project structured like so:
So our package.json and node_modules are located in a subfolder of the project root. But our pre-commit hook, handled by lefthook, was taking 45+ seconds to run on every commit, which was strange because if I ran
npx lefthook run pre-commit
it took less than 5 seconds.I finally looked into it, added some
echo
statements to the pre-commit script, and discovered the following:npx @evilmartians/lefthook
.There's no message to indicate that lefthook is falling back to installing itself from the NPM registry, so it took me a while to figure out what has happening.
Lefthook version
1.4.3
Steps to reproduce
npm install --save-dev lefthook
npx lefthook install
git commit
Expected results
I would see some message indicating that my lefthook installation was not found.
Actual results
The version of lefthook installed in subfolder/node_modules is not found, and @evilmartians/lefthook is downloaded from the NPM registry instead.
Possible Solutions
npx
may download it from NPM, introducing a large delay into the hook.The text was updated successfully, but these errors were encountered: