Skip to main content

Crate git_cow

Crate git_cow 

Source
Expand description

Git worktrees cloned from a per-repository template checkout, sharing disk blocks until written. macOS clones whole directories with clonefile(2), Linux uses cp --reflink=always (FICLONE)

Structs§

Options
What to share and how often to refresh the template from the checkout

Enums§

Added
How add_or_plain made the worktree

Constants§

DEFAULT_SHARE
Hidden directories that hold only build caches, so they are shared like any other ignored directory. Every other path with a hidden component is tool or agent config and stays out

Functions§

add
Create wt by cloning template, refreshed to template_start and warmed from repo first. new_branch and commitish are git worktree add’s; on error nothing is left behind
add_or_plain
add_with, or git worktree add with the same wt, new_branch and commitish when cloning fails. A failed clone leaves nothing behind, so the plain add starts clean
add_with
add with your own Options
can_clone
Whether a file in src_dir clones into dst_dir: both on one volume that supports it. Probed with one small file, since filesystem names miss mount options like XFS without reflink
git
Runs git in dir and returns its trimmed stdout
remove_template
Remove template, its registration in repo, and the lock, stamp and staging files next to it. Call it only when no add or warm on this template can run: one waiting for the lock would get a deleted file, and the next caller a new one
warm
Refresh an existing template with the gitignored directories of src, a checkout or a worktree whose work merged. Shares the hidden directories in DEFAULT_SHARE
warm_with
warm with your own Options. It always warms, the interval only applies to add_with