Repository navigation
Commit e55fdae
fix(hooks): print the --no-track worktree recipe in both guards' remediation text (#7000)
`.claude/hooks/guard-main-checkout.sh` and `.claude/hooks/guard-main-checkout-bash.sh`
each end their block message with the worktree recipe to run instead, and both created
the branch with a plain `-b`. PR #6976 hardened the prescribed form in `CLAUDE.md` and
`AGENTS.md`; the hooks' copy was left behind — and it is the higher-leverage copy,
delivered at the exact moment an agent is about to act, so it is the one most likely to
be run verbatim.
The hazard is the one #6976 established: plain `-b` writes the new branch's upstream keys
(`branch.NAME.remote`, `branch.NAME.merge`) into the one `.git/config` that every linked
worktree of a repo shares. That write can fail after the branch is created, leaving a
branch with no worktree — a half state the error text does not name. Read as "the
worktree exists", the agent starts editing the shared primary checkout, which is the one
thing these two guards exist to prevent.
Additive, not a recipe rewrite: this repo's hooks already emitted the fetch-hardened base
(`git fetch origin main && … origin/main`, landed for ui#6208), so the missing flag was
the only surviving divergence from the prescribed form. One word added per file, net ±0
lines in both.
Claude-Session: https://claude.ai/code/session_01EnE7G31tqbxN1rqpQmzurT
Co-authored-by: Claude <noreply@anthropic.com>1 parent ce7b7ec commit e55fdae
3 files changed
Lines changed: 44 additions & 2 deletions
File tree
- .changeset
- .claude/hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | | - | |
| 544 | + | |
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
0 commit comments