Problem
A mutating command such as git -C <isolated-worktree> cherry-pick <commit> can receive the shared-tree ownership checkpoint for the caller’s checkout, even though it targets a separate worktree. The action is not executed and must be resubmitted.
Cause
isSharedTreeGit skips the value of -C and returns only a mutation classification. gateCheck then checks the global current-worktree identity, without receiving the command’s effective target. A shell cd before Git has the same mismatch.
Fix
Resolve the effective mutation target before checking ownership, including explicit Git directory options and safely resolvable shell directory changes. Keep conservative handling for ambiguous commands.
Regressions should prove that an unrelated checkout owner does not block an isolated target, an owner of the actual target still triggers the checkpoint, and a subdirectory of the same worktree does not bypass it.
Problem
A mutating command such as
git -C <isolated-worktree> cherry-pick <commit>can receive the shared-tree ownership checkpoint for the caller’s checkout, even though it targets a separate worktree. The action is not executed and must be resubmitted.Cause
isSharedTreeGitskips the value of-Cand returns only a mutation classification.gateCheckthen checks the global current-worktree identity, without receiving the command’s effective target. A shellcdbefore Git has the same mismatch.Fix
Resolve the effective mutation target before checking ownership, including explicit Git directory options and safely resolvable shell directory changes. Keep conservative handling for ambiguous commands.
Regressions should prove that an unrelated checkout owner does not block an isolated target, an owner of the actual target still triggers the checkpoint, and a subdirectory of the same worktree does not bypass it.