Open ivan94fi opened 4 days ago
A couple of caveats.
I can stop everything on pre-commit hooks, but not on post-commit hooks. The bump will already have happened and be committed and tagged (if configured that way).
Stopping will also leave the repo in an unknown state since bump-my-version has no idea what happens in the hooks.
Any other thoughts about this with that caveat in mind? Any configuration or other things I should keep in mind?
I can stop everything on pre-commit hooks, but not on post-commit hooks
Yes, this makes sense, the stopping behavior should only happen in setup and pre hooks. In post-commit hooks it would great if we could see a warning message instead of logging at debug level, so that the message would be visible by default.
Stopping will also leave the repo in an unknown state since bump-my-version has no idea what happens in the hooks
That is true, and it is not bump-my-version's responsibility to predict what could be done in those hooks. I think the right way to proceed is to just revert the edits to the files modified by bump-my-version up to that point. For everything else it should be documented that it is the hook creator's responsibility to clean up.
As for the rest, nothing else comes to my mind at this moment.
Thank you for your work, I will be happy to provide feedback and discuss other issues.
Good points.
I'll schedule this for this weekend (September 28-29).
Description
When a command in a pre or post commit hook fails, I expect the bump to fail as well, but this does not happen.
This is because the errors on
subprocess.run
calls are not handled, but simply logged and ignored. See the0.26.1
tag version of therun_hooks()
function: https://github.com/callowayproject/bump-my-version/blob/683904a587a37305e42a29af9c53f27c8f369550/bumpversion/hooks.py#L92-L106What I Did
Running bump-my-version with the following config:
Is there any chance that this feature would be implemented? Thank you