fix: update worktree .git pointers after forward repo migration#51
Merged
guodong-sq merged 1 commit intomainfrom Mar 22, 2026
Merged
fix: update worktree .git pointers after forward repo migration#51guodong-sq merged 1 commit intomainfrom
guodong-sq merged 1 commit intomainfrom
Conversation
When wt context add migrates a repo (moves it to ~/.wt/repos/<name>/base and creates a symlink at the original location), pre-existing worktrees' .git files still point to the symlink path. After wt switch moves the symlink away from base, these worktrees break because the symlink path no longer resolves to a .git directory. Fix: after migration, update all worktree .git files to use the physical base path. Extract _wt_update_worktree_pointers as a shared helper used by both context add (forward) and context remove (reverse). Also call updateWorktreePointers from the plugin's AddContextAction migration path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38892c3 to
2b4f0de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wt context addbreak afterwt switchbecause their.gitfile pointers use the symlink path instead of the physical base path.gitfiles are now updated to use the physical path_wt_update_worktree_pointersas a shared helper used by bothwt context add(forward migration) andwt context remove(reverse migration, from PR fix: update worktree .git pointers after context remove repo restore #50)AddContextActionnow also callsupdateWorktreePointersafter migrationTest plan
bats test/unit/wt-context-setup.bats(3 new tests for_wt_update_worktree_pointers)bats test/integration/wt-context-remove.bats(existing pointer test validates shared helper)./gradlew test🤖 Generated with Claude Code