Replies: 2 comments
-
|
I'm running into this same thing. What I'd like to see is the same behavior as pre-commit. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I have given this a crack in #1095 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
lefthook newbie here, just started to dabble with it. Long experience with pre-commit.
One thing I'm used to and missing in lefthook is the ability to fail on modified ("fixed") staged files on pre-commit. As far as I understand:
stage_fixed: trueis pretty nice and convenient for some scenarios, but:Some tools can be made to exit with nonzero exit status when they modify files, which kind of serves as a workaround for the former. Shell scripting or something like that could be used to make the exit status nonzero if there are modified files, but shell scripting is not portable, and IMHO this is something one should not have to script, but should Just Work :)
So, I would like to propose making it possible to exit with nonzero status when a tool made any modifications to the tree. Given green field, I'd personally make that the default (maybe even without ability to turn it off :)), but I understand this would be a backwards incompatible change.
Therefore, perhaps a new config option
fail_fixed(defaultfalse), which if true, would cause a nonzero exit status if there were any modified files in the tree as a result of some command, no matter whatstage_fixedis set to (stage_fixed: truecould do its thing together with this option, no need to prevent it).Alternatively, if it would be possible to specify multiple
runs for a singlecommand, that could be used to achieve this by just adding agit diff --exit-codecommand as the last. But that'd open the can of worms of having to specify whether theseruns run only up to the one that failed, or all no matter what the exit status of the previous one is, and would not thus work for all tools/cases.Thoughts? Am I missing something that makes the above possible already?
Beta Was this translation helpful? Give feedback.
All reactions