Expand description
Seeding a Cargo target directory from an existing one.
Cutting a git worktree, or any second checkout, leaves a build that starts
from nothing. Copying target/ across is the obvious fix and the wrong one:
it is routinely tens of gigabytes. What this crate does instead is build the
new directory out of the old one’s storage — a block clone where the
filesystem offers it, and a hard link for the large write-once artifacts
where it does not — so the second tree is warm without being a second copy.
What belongs here is what Cargo knows: where the target directory is, which of its contents may be shared, which must be a file of their own, and that a half-built tree must never be visible under a name Cargo reads. Deciding where the new tree goes is the caller’s; a git worktree is one answer and not a special one.
Modules§
- lock
- Taking part in Cargo’s build lock, so that a tree is not read while it is being written.
Structs§
Enums§
Constants§
- DEFAULT_
MIN_ SHARED_ SIZE - Files this size and above under a
deps/directory keep a shared inode rather than a copy of their own.
Functions§
- seed
- Builds
destfromsrc, sharing whatever the filesystem underdestlets it share. - supports_
reflink - Whether the blocks of files in
srccan be cloned intoatrather than copied. - workspace_
target_ dir - The target directory Cargo itself would use for the workspace containing
cwd.