Skip to content

Fix operation state restoration in linked worktrees#887

Open
xenyal wants to merge 1 commit into
sds:mainfrom
xenyal:fix/linked-worktree-operation-state
Open

Fix operation state restoration in linked worktrees#887
xenyal wants to merge 1 commit into
sds:mainfrom
xenyal:fix/linked-worktree-operation-state

Conversation

@xenyal

@xenyal xenyal commented Jul 24, 2026

Copy link
Copy Markdown

Context

I ran into this through a confusing shell prompt error after completing work in a linked worktree. Overcommit was restoring merge and cherry-pick state into the shared Git directory, which can make another checkout appear to be mid-operation. The shared directory is right for hooks, but these state files belong to the active worktree.

Changes

  • Resolve operation-state files through git rev-parse --git-path, with a fallback for Git versions before 2.5.
  • Restore MERGE_HEAD, MERGE_MODE, MERGE_MSG, and CHERRY_PICK_HEAD in the active worktree.
  • Preserve merge mode and message contents exactly.

@xenyal
xenyal marked this pull request as ready for review July 24, 2026 04:11
@xenyal
xenyal force-pushed the fix/linked-worktree-operation-state branch from 064e0dd to 91717e3 Compare July 24, 2026 04:14
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