-
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
Cannot force command to run with --all-files unless using {files}
#554
Comments
Hey, in v1.5.1 I've added a I think it would be a bad design to distinguish between manual run and hook-triggered run. However it is not impossible. |
@mrexox I requested to be able to run a hook with either all files or the staged files, per the hook configuration, regardless of the name of the hook ( |
@sanmai-NL , I understand your case. There is an implicit check in It looks like you want to use lefthook for manual hooks without those tweaks. I can suggest you to use the YAML anchors: checks:
files: <a custom command for files whether it is staged files or push files >
commands: &checks
pdm-lock:
glob: <here you can specify any filters>
run: pdm lock --group ':all' --refresh
# ...
pre-push:
commands: *checks # here push files will be used implicitly
pre-commit:
commands: *checks # here staged files will be used implicitly So, you use git hooks when calling lefthook implicitly and custom hooks when calling explicitly via |
@mrexox That doesn't pick up other settings of the hook, like I don't really see the logic of that convenience. Was there a problem for users? |
There were the following issues:
Could you share your requirements, so I could think out a proper configuration? |
🔧 Summary
Lefthook version
1.5.0
Steps to reproduce
.lefthook.yml
:Expected results
When invoked manually, commands are always run, regardless of template occurrence in the command line.
Actual results
pre-push
hook needlessly checks whether there is something to push, even when invoked manually.{files}
template is used in the command line, the check whether there is something to push is suddenly skipped and the command is run, however.Possible Solution
When invoked manually, commands are always run, regardless of template occurrence in the command line.
Logs / Screenshots
When a (dummy)
{files}
template is used, the command is run, however.The text was updated successfully, but these errors were encountered: