Skip to content
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

Use --no-auto-install by default when executing run hooks #840

Open
cgaube opened this issue Oct 11, 2024 · 2 comments
Open

Use --no-auto-install by default when executing run hooks #840

cgaube opened this issue Oct 11, 2024 · 2 comments
Labels
feature request A new lefthook feature description

Comments

@cgaube
Copy link

cgaube commented Oct 11, 2024

⚡ Summary

Hooks are triggered when executing git commands like git commit
When lefthook is executed it automatically check if the hooks are installed

This is I believe useless as if the hooks were triggered it means the hooks are installed

#715
#716

Value

We stop doing things that we don't need to do :D

Behavior and configuration changes

When lefthook run is executed via a hook dont check if hook is installed

https://github.com/evilmartians/lefthook/blob/master/internal/lefthook/run.go#L96-L106

@cgaube cgaube added the feature request A new lefthook feature description label Oct 11, 2024
@mrexox
Copy link
Member

mrexox commented Oct 14, 2024

Hey @cgaube , there is a small nuance. You may change the global settings of the config which affect the script in the git hooks, so the sync is required. Lefthook also supports the flow when you only do lefthook install once and then it keeps tracking the changes of the config file without manual lefthook install for convenience.

Also nothing will be installed if not required because lefthook calculates the hashsum of the config file and skips syncing hooks if nothing changed in the main config file.

So, this implicit installation step does not affect the execution time a lot, but reduces the need to manually install the hooks every time you change the configuration or add a new hook.

@cgaube
Copy link
Author

cgaube commented Oct 14, 2024

So, this implicit installation step does not affect the execution time a lot, but reduces the need to manually install the hooks every time you change the configuration or add a new hook.

Gotcha, this is indeed helpful.

I would still love to be able to disable this behavior via configuration file though :)

nazarewk added a commit to nazarewk/std that referenced this issue Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new lefthook feature description
Projects
None yet
Development

No branches or pull requests

2 participants