Skip to content

fix(hooks): detect worktree CWD in branch-safety and unified-gate#210

Merged
notque merged 1 commit intomainfrom
fix/hook-worktree-cwd-detection
Mar 30, 2026
Merged

fix(hooks): detect worktree CWD in branch-safety and unified-gate#210
notque merged 1 commit intomainfrom
fix/hook-worktree-cwd-detection

Conversation

@notque
Copy link
Copy Markdown
Owner

@notque notque commented Mar 30, 2026

Summary

  • Add _extract_effective_cwd() helper to both pretool-branch-safety.py and pretool-unified-gate.py
  • Parses cd <path> && and git -C <path> from commands to find the actual working directory
  • branch-safety: No longer blocks worktree commits by mistakenly checking the main repo's branch
  • unified-gate: Allows worktree feature-branch submissions without requiring CLAUDE_GATE_BYPASS

Test plan

  • Unit tests for _extract_effective_cwd() pass (cd prefix, cd semicolon, git -C, git -C quoted, no prefix, cd quoted)
  • ruff check + format pass
  • CI passes (lint, test, routing-benchmark)

Add _extract_effective_cwd() helper that parses 'cd <path> &&' and
'git -C <path>' from commands to determine the actual working directory.

branch-safety: no longer blocks worktree commits by mistakenly reading
the main repo branch as 'main'.

unified-gate: allows worktree feature-branch submissions without
requiring CLAUDE_GATE_BYPASS.
@notque notque merged commit ed90360 into main Mar 30, 2026
4 checks passed
@notque notque deleted the fix/hook-worktree-cwd-detection branch March 30, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant