-
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
Fail if no lefthook was found #212
Comments
Well, I believe that by default it shouldn't fail if binary wasn't found. It is better to miss something than completely break workflow for some people, IMO. I don't see a case why we should always abort commit/push/whatever in case we can't perform git hook checks (because hooks are easily skippable by If you want to enforce some rules (code linting, commit messages, whatever), you'd better to do this on CI (git hooks just helps to shorten feedback loop). |
It can break someone with a modified PATH also #178 |
There are several escape paths already if things goes wrong
And similar as for @skryukov it broke for me twice already. The use case - I pull latest changes which introduce a new gem in Gemfile, then make some changes myself and commit them without doing |
People add lefthook for a reason even if it is easy to skip. I think it should break and print a reasonable message what to do if one still wants to proceed. |
Opened PR - #213 |
ooh, |
I've just installed lefthook using snap and by default git actions fail if no lefthook config file is found. Is there any way to change this behavior without the need to add |
Could you describe what happened? You have git hooks using lefthook, but no lefthook.yml in your git project, right? And you'd like to see only a warning and not to stop git from creating a commit, right? |
@mrexox yes, exactly |
I'll try to prepare a fix by next week 👍 |
Hey @roman-ih! Sorry for the long delay. It feels like changing current behavior is a big change for lefthook. So, I'd like to suggest an option. What do you think of having a global config option for that, like |
I'm interested in this feature as well, and such a global configuration sounds very useful. The next-best option if the default cannot be changed for everyone. |
@hyperupcall, cool! Do you like |
For me |
Currently, if lefthook was not found, the user will see the message "Can't find lefthook in PATH" but commit still will go through.
IMHO it is not how it should work. The fix can be as simple as adding
exit 1
in the else clause.The text was updated successfully, but these errors were encountered: