Skip to content

fix(worktree): respect active worktrees in existing commands - #1683

Draft
casey-chow wants to merge 1 commit into
arxanas:masterfrom
casey-chow:casey-chow/worktree-pair-pr2-safety
Draft

casey-chow wants to merge 1 commit into
arxanas:masterfrom
casey-chow:casey-chow/worktree-pair-pr2-safety

Conversation

@casey-chow

Copy link
Copy Markdown
Contributor

This teaches existing branchless commands to respect branches that are currently checked out in linked worktrees.

Before this, commands which rewrote or revisited refs could accidentally move a branch that was active in another worktree, leaving that other checkout inconsistent with its branch. The change adds a shared linked-worktree check before branch moves, makes undo refuse to replay ref updates for branches active elsewhere, and avoids auto-switching onto branches already checked out in a worktree.

This also updates navigation display to include worktree context when selecting commits, and adds regression coverage for restack and undo behavior around active linked worktrees.

Validated locally with cargo check -p git-branchless-navigation -p git-branchless-undo -p git-branchless and TEST_GIT=$(which git) TEST_GIT_EXEC_PATH=$(git --exec-path) cargo test -p git-branchless --test test_restack --test test_undo.

Prepared with substantial Codex assistance.

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