Repository navigation
feat(worktree): never overwrite edits when checking out - #102
Open
PiquelChips wants to merge 1 commit into
Open
PiquelChips wants to merge 1 commit into
PiquelChips wants to merge 1 commit into
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
PiquelChips
force-pushed
the
feat/workspaces-safe-checkouts
branch
2 times, most recently
from
November 22, 2026 18:54
5f0d631 to
8ba2b01
Compare
A command that moves the working copy, such as `edit`, `abandon`, `converge` or following a landing, checked out over whatever was there: an edit made after its snapshot, while the command ran, was lost. With the stat cache of the snapshot, a checkout now first checks that no file it changes was edited since, by metadata or, for files the cache doesn't vouch for, by content, and changes nothing if one was. It checks each file again just before it replaces it. A directory that still holds untracked files, such as a `.git`, is never turned into a file. A command moving the working copy writes the new revision only once its checkout is done: a refused checkout writes nothing, and takes back the files it changed with `Worktree::restore`, leaving edited ones as they are, so the working copy and its change stay where they were.
PiquelChips
force-pushed
the
feat/workspaces-safe-checkouts
branch
from
November 22, 2026 19:20
8ba2b01 to
bf79111
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.
A command that moves the working copy, such as
edit,abandon,convergeor following a landing, checked out over whatever was on disk. An edit made after its snapshot, while the command ran, was lost.Given the stat cache of the snapshot it starts from, a checkout now:
.git, a FIFO or a file created since.A command that moves the working copy writes the new revision only once its checkout is done. A refused or failed checkout writes nothing, and takes back the files it changed with
Worktree::restore, leaving edited ones as they are, so the working copy and its change stay where they were and the command can run again.Review fix: any failed checkout takes its files back, not only one refused by an edit. Proved with
a_move_that_fails_takes_its_files_back, which fails without the fix.Note
Written by Claude Opus 5.5 in Claude Code (via T3 Code)