fix: block all git push to protected branches, not just force push#308
Open
fix: block all git push to protected branches, not just force push#308
Conversation
Also fixes false positive where git stash push was matched as git push. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Benchmark
Details
| Benchmark suite | Current: c450349 | Previous: 5486031 | Ratio |
|---|---|---|---|
tests/benchmarks/test_bench_core.py::test_bench_greet_default |
8889541.225256031 iter/sec (stddev: 1.1520710667598202e-8) |
8166984.352580131 iter/sec (stddev: 1.2600047111595168e-8) |
0.92 |
tests/benchmarks/test_bench_core.py::test_bench_greet_with_name |
8876003.404447401 iter/sec (stddev: 1.0900137899848911e-8) |
8306651.00208249 iter/sec (stddev: 1.0151140556058403e-8) |
0.94 |
tests/benchmarks/test_bench_core.py::test_bench_greet_long_name |
5495310.254050291 iter/sec (stddev: 3.467121077901487e-8) |
5593233.539409745 iter/sec (stddev: 1.4238505859520605e-8) |
1.02 |
tests/benchmarks/test_bench_logging.py::test_bench_get_logger |
1697542.1975712706 iter/sec (stddev: 2.360904760311015e-7) |
1683086.6830090855 iter/sec (stddev: 2.0472155012615866e-7) |
0.99 |
tests/benchmarks/test_bench_logging.py::test_bench_setup_logging |
502234.6146149284 iter/sec (stddev: 5.242133122140792e-7) |
488272.1664871446 iter/sec (stddev: 4.338613854146437e-7) |
0.97 |
This comment was automatically generated by workflow using github-action-benchmark.
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.
Description
The
block-dangerous-commands.pyhook only blocked force pushes to protected branches. Regulargit pushwhile onmainwas allowed, letting AI agents push directly to main bypassing the PR workflow.Also fixes a false positive where
git stash pushwas incorrectly matched asgit push.Addresses #307
Type of Change
Changes Made
check_force_push_to_protected→check_push_to_protectedgit pushwhen current branch is protected (main/master)git pushis matched, notgit stash pushgit push -u origin fix/123)Testing