Repository navigation
fix(server): Edit from here recreates a worktree folder that lost its checkout #35194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+82
−38
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
07bf30a
test(server): rollback recreates a managed worktree folder that lost …
juliusmarminge 9716a1b
fix(server): Edit from here recreates a worktree folder that lost its…
juliusmarminge 262e832
fix(server): conversation-only rollback keeps a leftover worktree folder
juliusmarminge f18d433
fix(server): rollback checks workspace isolation before clearing a le…
juliusmarminge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve user files in the leftover folder before recreating the checkout.
When
restoreFilesis true and the workspace is isolated, the leftover managed folder (it exists without.git) is removed recursively at line 251. Any untracked user files in that folder, such asunsaved.txtin the test fixture, are deleted. The removal runs beforepruneWorktreesandcreateWorktree, so a failure in either step leaves those files deleted. The later checkpoint restore cannot recreate files that the checkpoint does not contain.Isolation shows only that no other thread shares the folder. It does not show that the folder's files are disposable. Issue
#35156requires preserving folders that contain user files, and this branch deletes them.Move the folder aside instead of deleting it. Rename
worktreePathto a unique backup path withfileSystem.rename, then prune and recreate the checkout, and keep the backup. Keep theshared-workspacerejection unchanged. Rejecting every non-empty folder would also block the recreation this change is meant to enable.Update the
leavesFolder+restoreFilescase in the locks rollback test. The case currently accepts deletion because it asserts only the recreation calls. It should assert that the preserved file exists at the backup location.