Expand description
Linked worktree registry: discovery, listing, and admin-dir layout.
Git stores linked worktrees under <common-git-dir>/worktrees/<id>/ with
gitdir, commondir, HEAD, and optional locked / prunable files.
This module reads that layout; lifecycle mutations (add / remove) remain
in the CLI for now and will move here in Phase 1.2.
Structs§
- Worktree
Entry - One row returned by
list_worktrees.
Functions§
- allocate_
worktree_ admin_ dir - Pick a unique
<common>/worktrees/<id>/directory for a new linked worktree atwt_path. - common_
git_ dir - Shared git directory for
git_dir(followscommondirfor linked worktrees). - copy_
filtered_ worktree_ config - Copy
config.worktreeinto a linked worktree admin dir, stripping keys Git omits whenextensions.worktreeConfigis enabled (core.bare,core.worktree). - is_
bare_ repository - Whether
commonis configured as a bare repository (core.bare=true). - list_
worktrees - Enumerate the main and linked worktrees for
repo. - read_
worktree_ path - Read the working tree path from
<admin>/gitdir(parent of the worktree.gitfile). - registered_
worktree_ count - Number of registered worktrees (main + linked entries under
worktrees/). - resolve_
linked_ head - Resolve HEAD for a linked worktree admin dir (
HEADlocal, branch refs incommon). - sanitize_
worktree_ id_ component - Sanitize a path basename for use as
worktrees/<id>/(Gitsanitize_refname_component). - worktree_
path_ basename - Last path component of
path, without trailing directory separators (Gitworktree_basename).