Skip to content

Shared-tree guard checks the caller instead of the explicit Git target #851

Description

@yxlyx

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions