fix: improve git hook safety — fail-closed on missing jq, catch -- separator#2
Open
hobostay wants to merge 1 commit intoevanklem:mainfrom
Open
fix: improve git hook safety — fail-closed on missing jq, catch -- separator#2hobostay wants to merge 1 commit intoevanklem:mainfrom
hobostay wants to merge 1 commit intoevanklem:mainfrom
Conversation
…parator variants Two safety improvements to block-dangerous-git.sh: 1. Fail-closed when jq is missing: previously the hook silently allowed all commands if jq was not installed. Now it blocks commands with a clear error message instead. 2. Catch `--` separator variants: `git checkout -- .` and `git restore -- .` are common alternatives to discard all working directory changes but were not blocked by the existing patterns. Added patterns to catch these. Also removed the redundant `git clean -fd` pattern since `git clean -f` already matches it as a substring. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
--separator variants:git checkout -- .andgit restore -- .are common ways to discard all working directory changes but were not caught by the existing patterns. Added patterns for both.git clean -fdpattern:git clean -falready matchesgit clean -fdas a substring, making the-fdentry redundant.Test plan
git checkout -- .andgit restore -- .git push,git reset --hard, etc.)🤖 Generated with Claude Code