Skip to content

Commit 1894791

Browse files
stranmaclaude
andcommitted
test: document force-push variant behavior
Add tests asserting that --force-with-lease and -u -f variants hit the ask rule (not deny), confirming they still require user confirmation even though they bypass the deny prefix patterns. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent c5757aa commit 1894791

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/test_permissions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ def test_git_push_force_is_denied(self, settings: dict[str, Any]) -> None:
307307
assert evaluate("Bash(git push --force origin main)", settings) == "deny"
308308
assert evaluate("Bash(git push -f origin main)", settings) == "deny"
309309

310+
def test_git_push_force_variants_require_confirmation(self, settings: dict[str, Any]) -> None:
311+
"""Force-push variants with different flag ordering hit ask (not deny).
312+
313+
--force-with-lease and -u -f don't match the deny prefix patterns,
314+
but git push * is in ask so they still require user confirmation.
315+
"""
316+
assert evaluate("Bash(git push --force-with-lease origin main)", settings) == "ask"
317+
assert evaluate("Bash(git push -u -f origin main)", settings) == "ask"
318+
310319
def test_rm_rf_is_not_allowed(self, settings: dict[str, Any]) -> None:
311320
assert evaluate("Bash(rm -rf /)", settings) != "allow"
312321

0 commit comments

Comments
 (0)