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§
- Occupied
- The error inside the
io::ErrorKind::AlreadyExiststhatadd_withreturns for awtthat exists and is not empty. Test for it withis_occupied - Options
- What to share and how often to refresh the template from the checkout
- Unsupported
- The error inside the
io::Errorwhen git-cow cannot clone here at all: the volume has no clone support or the repository has submodules. Test for it withis_unsupported
Enums§
- Added
- How
add_or_plainmade the worktree - Foreign
- A template path that is not a git-cow extra checkout, inside the
io::Errorthatadd_with,warm_withandremove_templatereturn. They leave it alone, and onlyOptions::forceinadd_withreplacesForeign::Files. The message names the path, the advice is the caller’s
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
- REPO_
ENV - Variables that point git at another repository or index than
-Cnames, set by hooks orgit --git-dir. git-cow’s own calls would read or rewrite the user’s repository through them
Functions§
- add
- Create
wtby cloningtemplate, refreshed totemplate_startand warmed fromrepofirst.new_branchandcommitisharegit worktree add’s. Like it, refuses awtthat exists and is not empty, and on error removes only the worktree and branch this call created - add_
or_ plain add_with, orgit worktree addwith the samewt,new_branchandcommitishwhen cloning fails. A pathis_refusedis returned with no plain add- add_
with addwith your ownOptions- can_
clone - Whether a file in
src_dirclones intodst_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, withoutREPO_ENV, and returns its trimmed stdout - is_
occupied - Whether
eisadd_withrefusing awtthat exists and is not empty, where a plaingit worktree addwould fail too - is_
refused - Whether
eisOccupiedorForeign, a path git-cow leaves alone. A plaingit worktree addmust not run instead, since the path needs the user first - is_
unsupported - Whether
eisUnsupported, where a plaingit worktree addis expected. Any other clone error also falls back inadd_or_plain, and a caller may warn that cloning failed - remove_
template - Remove
template, its registration inrepo, and the lock, stamp and staging files next to it. A path that is not an extra checkout git-cow made fails withForeignand stays. Call it only when noaddorwarmon 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
templatewith the gitignored directories ofsrc, a checkout or a worktree whose work merged. Shares the hidden directories inDEFAULT_SHARE - warm_
with warmwith your ownOptions. It always warms, the interval only applies toadd_with