-
-
Notifications
You must be signed in to change notification settings - Fork 773
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
pre-push
hooks are intentionally not run on ref deletion
#3050
Comments
Snooping around, the behavior seems related to these lines pre-commit/pre_commit/commands/hook_impl.py Lines 127 to 128 in 14169eb
which return a namespace of |
pre-commit is for linting new change sets and so deletions are ignored. you can use a legacy hook if you want but your use case is intentionally not managed by the framework |
no. this would be a breaking change |
It indeed would be breaking as written. Perhaps "pre-push on ref deletion" could be enabled via some sort of configuration flag, which is disabled by default? (This is my last suggestion before conceding, as surely I do not understand the full scope of such a change). |
yeah I'm not going to add a configuration option for something I would never use, and something the tool intentionally is designed to not support. you're free to maintain a fork though to add whatever functionality you might want |
pre-push
hook executed or skipped?pre-push
hooks are intentionally not run on ref deletion
Maintaining/packaging a fork is not worth it for me, so I will pursue other options. Thanks for the discussion. Changed issue name to aid future searchers. |
search you tried in the issue tracker
pre-push
describe your issue
I am attempting to write a
pre-push
hook which prevents tag deletion.By way of print statements, I observe the following behavior.
When I install the pre-push hook via pre-commit:
git push origin tmptag
, the hook is invoked.git push origin :tmptag
, the hook is not invokedIn contrast, if I forgo pre-commit and manually put a
pre-push
file in my.git/hooks/
foldergit push origin tmptag
, the hook is invoked.git push origin :tmptag
, the hook is invokedAm I misunderstanding how the
pre-push
hook of pre-commit is supposed to work? Or is there some logic within pre-commit to skip the execution ofpre-push
hooks under certain circumstances?pre-commit --version
3.3.3
.pre-commit-config.yaml
~/.cache/pre-commit/pre-commit.log (if present)
No response
The text was updated successfully, but these errors were encountered: