Skip to content

feat(worktree): clone checked-out files from other working copies - #103

Merged
PiquelChips merged 1 commit into
feat/workspaces-safe-checkoutsfrom
feat/workspaces-clones
Nov 23, 2026
Merged

PiquelChips merged 1 commit into
feat/workspaces-safe-checkoutsfrom
feat/workspaces-clones

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

A checkout read every file it writes from the store, decompressing and verifying it, even when another working copy of the repository already has the same file on disk. This is the copy-on-write half of workspaces, which come next in the stack.

A checkout can now take CloneSources, which are other working copies:

  • Files whose stat caches prove them unmodified are cloned, or copied where the file system cannot clone. After the first refusal, it copies from then on.
  • The original is checked again after the clone: any write would have moved its ctime past the time its entry settled at.
  • Clones get the mode their entry names, since some platforms give a clone the original's mode, and originals are found by content.
  • A source's stat cache is only read while some file still has no original. Other files are written from the store.

Benchmark: the workspace benchmark now also copies and clones the 20,000-file tree from another working copy. Set TMPDIR to a directory on Btrfs, XFS or APFS to measure real clones.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dd9d4f38-6321-4b15-9204-b0305d8d35e4
Commits

Reviewing files that changed from the base of the PR and between 714bfea and bc515a8.

Files selected for processing: 3

  • apps/origin-src/benches/workspace.rs
  • apps/origin-src/src/workspace/mod.rs
  • apps/origin-src/src/worktree.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@PiquelChips
PiquelChips added this pull request to stack #165 November 22, 2026 14:59
@PiquelChips
PiquelChips force-pushed the feat/workspaces-clones branch 4 times, most recently from bdd21ce to dee892f Compare November 23, 2026 12:30
@PiquelChips
PiquelChips force-pushed the feat/workspaces-clones branch 2 times, most recently from 720aa1d to ff74296 Compare November 23, 2026 18:03
A checkout read every file it writes from the store, decompressing and
verifying it, even where another working copy of the repository has the
same file on disk.

A checkout can now take `CloneSource`s, other working copies, and
clones the files whose stat caches prove them unmodified, or copies them
where the file system cannot clone; the first refusal makes it copy from
then on. The original is checked again after the clone, and every write
would have moved its ctime past the time its entry settled at. Clones get
the mode their entry names, since some platforms clone the original's. A
source's stat cache is only read while some file has no original yet.
Other files are written from the store.

The `workspace` benchmark now also copies and clones the tree from
another working copy.
@PiquelChips
PiquelChips force-pushed the feat/workspaces-clones branch from ff74296 to bc515a8 Compare November 23, 2026 21:39
@PiquelChips
PiquelChips merged commit d08dfe1 into main Nov 23, 2026
6 checks passed
@PiquelChips
PiquelChips deleted the feat/workspaces-clones branch November 23, 2026 22:51
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