Skip to main content

Module state

Module state 

Source
Expand description

What git says about the state of a work tree and of every branch: uncommitted work from status --porcelain, and every local branch with its upstream, its distance from it and the work tree holding it from one for-each-ref. Nothing here fetches.

Structs§

BranchRef
One local branch as for-each-ref reports it.

Functions§

aged_dirty_state
Uncommitted work in a work tree, counted as dirty_state counts it, with the moment of its oldest change: the earliest modification time among the paths git status names. A changed path that no longer exists on disk — a deletion — has no time of its own, and the index file’s modification time stands in for it, as it does for a work tree whose paths cannot be read at all. None only when neither can be read.
branch
One local branch, read now: the same fields as branches, for a caller that must not act on a reading taken earlier. None when the branch no longer exists.
branches
Every local branch, in one subprocess: name, commit, upstream with its ahead/behind distance, and the work tree holding it.
dirty_state
Count the entries of git status --porcelain -z for a work tree. Untracked files are counted as files (--untracked-files=all), because a directory of untracked work is the thing a move must not lose and “1 untracked” for a directory of forty files would understate it.
dirty_states
The dirty state of many work trees, measured at once.
gitdir_link
The path a linked work tree’s .git file names, when it names one. Git writes exactly one line, gitdir: <path>, and the path is normally absolute.
issue_ids
The issue ids this repository’s project model declares: the file names under .ai/repo/project/issues/, read from the primary checkout. A filesystem read, not an index build, so the topology stays cheap.
issue_of
The issue a branch provably names: a path component equal to an issue id, or beginning with the id followed by -. Nothing else counts.
merged_into
Every local branch reachable from trunk, in one subprocess.
merged_into_trunk
Every local branch reachable from trunk or from the remote-tracking branch trunk follows. A local trunk that has fallen behind its remote — a primary checkout nobody has pulled, because a session holds uncommitted work in it — would otherwise call every branch that landed since unmerged, and cleanup would offer nothing; a branch the remote trunk contains is published and integrated, which is the safety cleanup asks for.
operation_in_progress
The operation git is in the middle of in this work tree, if any: what git status would report as “rebase in progress” and so on, read from the per-worktree git directory the way git itself does.
parse_branches
Parse the format above: five NUL-terminated fields per branch, one branch per line.
parse_status_z
Parse the NUL-separated porcelain v1 status. Renames are disabled by the caller (--no-renames), so every entry is XY path\0 and no entry is followed by a second path.
processes_inside
Which of these directories has a process working inside it right now, one answer per directory in the order given.