fix: uninstall without -t removes all pre-commit managed hooks#3633
Closed
Tiryoh wants to merge 1 commit intopre-commit:mainfrom
Closed
fix: uninstall without -t removes all pre-commit managed hooks#3633Tiryoh wants to merge 1 commit intopre-commit:mainfrom
Tiryoh wants to merge 1 commit intopre-commit:mainfrom
Conversation
Previously, `pre-commit uninstall` without `-t` only removed hooks listed in `default_install_hook_types` from the config. This meant hooks installed with e.g. `-t pre-push` would not be removed unless `-t pre-push` was explicitly passed to uninstall. Now, when `-t` is not specified, uninstall scans all known hook types and removes any that are managed by pre-commit (via `is_our_script`). Fixes pre-commit#364 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
ai slop is not acceptable and I'm not changing the behavior either way |
Author
|
Understood — thanks for clarifying. For the record: this PR was based on issue #364 where the change was mentioned as “patches welcome”. As that discussion is quite old, the current behavior being intentional makes sense. I'll drop the change. |
Member
|
a lot has changed in nearly a decade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #364
Thanks for maintaining this project for so long. I saw the "patches welcome" comment on #364 back in 2018 — is this kind of change still acceptable?
pre-commit uninstallwithout-tonly removed hooks based ondefault_install_hook_typesfrom the config. This meant hooks installed with e.g.-t pre-pushwould silently remain unless explicitly uninstalled with-t pre-push.This change makes
uninstallwithout-tscan all knownHOOK_TYPESand remove any managed by pre-commit (checked viais_our_script). Non-pre-commit hooks are left untouched.-tspecified: behavior unchanged-tnot specified: removes all pre-commit managed hooksinstall: behavior unchanged (still respectsdefault_install_hook_types)Test plan
test_uninstall_without_t_removes_all_hooks— installs multiple hook types, uninstalls without-t, all removedtest_uninstall_without_t_ignores_non_precommit_hooks— custom hooks are preserved