Skip to main content

Module cleanup

Module cleanup 

Source
Expand description

Worktrees and local branches whose work already landed in a base branch, and their removal. plan judges every worktree and branch, execute removes what the plan marks, and saves each commit it lets go of under refs/git-cow/deleted/ first

Structs§

Base
The branch a plan compares with
Item
One worktree, or a local branch with no worktree, and what the plan does with it. Only plan and plan_worktree make one, and a caller can read but never change it, so execute only ever removes what the plan judged safe:
Options
What to compare with, and whether to remove worktrees with changes or a missing folder too
Plan
Every worktree and local branch plan judged
Surveyed
A linked worktree and how far its work landed, None when no base branch resolves

Enums§

Action
What execute does with an item
Done
What execute did
Keep
Why a plan keeps a worktree or branch
State
How far a worktree’s or branch’s work landed in the base

Functions§

execute
Remove every worktree and delete every branch the plan marks Action::Remove. Each commit it lets go of is saved under refs/git-cow/deleted/<seconds>-<pid>-<call>/ first, and an item that moved since the plan stays
is_extra_checkout
Whether path is a git-cow extra checkout of the repository at repo: under a .git-cow folder, at cow.base, or with the lock file git-cow keeps beside each one. git lists real paths while cow.base may go through a symlink, so both sides are resolved
plan
Judge every worktree of the repository at dir, and every local branch with no worktree, against the base. It changes nothing
plan_worktree
Judge only the worktree at wt, as a tool does with a worktree it made once its work landed. The plan has that one item, and deletes its branch only if no other worktree has it
squash_check_works
Whether this git can tell a squash merge: it needs patch-id --verbatim and --attr-source, both in git 2.40. Without them squash-merged branches show as active and stay
survey
Every linked worktree of the repository at dir but the extra checkouts, with how far its work landed. It reads only commits and refs, never a worktree’s files, so no filter or hook a repository sets can run, which makes it fit for repositories you did not make