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
v3 won't install or work from a git worktree directory #580
Comments
Hi @zfeher, Thanks for the report. Husky v3 uses You can get some debug info during install using Would you also have some commands I can run to reproduce the issue locally? |
The requested debug output:
I noticed something new: If I installed husky in the main folder it worked. Then I uninstalled it, opened the worktree folder, installed husky there which didn't created hooks under You can repro this by making git worktrees in a cloned git repository. To do this:
Hope this helps. |
Hi @zfeher, It helped a lot, thanks! I've just published a new version which should fix the issue ( |
I'm having similar issues, and, with the new The
|
@forivall when you change directory it seems like the path to husky is different. As the layout/bug is a bit complex, could you provide steps to recreate the issue locally? I don't know if it applies, but you may want to check https://github.com/typicode/husky#monorepos, husky needs to be defined once in a project with multiple |
@typicode thank you for the fix, tried it and works for us flawlessly |
@typicode yeah, it seems like it has to do with our multi-repo setup, where there is a root repo to setup various utilities to work on multiple repositories in sync, & a yarn workspace to share deps, similar to https://github.com/ckeditor/ckeditor5. (although, we're currently using pre-commit for most repositories, and I decided to start the switch to husky for a new project). In the case where the error happens, the repo is in the workspace, and the worktree is outside of it. I have a (non reproducing) repro set up, and I'll add a parent repository to show the error in action. |
Ah, I figured out the workaround / fix. After adding this to the diff --git a/package.json b/package.json
index 7ae7807..e389194 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,8 @@
"."
],
"nohoist": [
- "**/husky"
+ "**/husky",
+ "**/run-node"
]
},
"scripts": { (I learned that husky needs to be in |
Hi' Thank you for working on this project.
Today we wanted to upgrade from 0.14.x to the latest 3.0.5 version. But it didn't work. The hooks didn't run. Checking the hooks directory seemed just fine. Removing husky, and the hooks manually an reinstalling husky did not install the hooks.
However downgrading to 2.6.0 version worked flawlessly.
Then I became suspicious about git worktrees and it seems that is the problem. If we want to install the latest husky from a git worktree it won't install/remove/run the hooks.
As it seems versions ranging from 0.14-2.6.0 are able to handle this.
The text was updated successfully, but these errors were encountered: