Skip to main content

Module checks

Module checks 

Source
Expand description

The six log-off checks, ported from the zsh isEverythingCheckedIn (code-conf gitCoreLib.sh). Each is a pure function over a &dyn Git, so it can be unit-tested with FakeGit. A repo is “ok” only if all six pass.

Structs§

RepoStatus
Outcome of all six checks for one repo.
RuleReport
One rule’s deep-dive report for logoff -e <N>: the live, per-repo state behind a single check, ready for crate::report::print_rule_detail to render.

Enums§

BaseSyncVerdict
Outcome of R6 (not-behind-base): is the current feature branch up to date with base? Fail-closed — anything we can’t determine (BaseSyncVerdict::Undeterminable) fails. Behind fails unless allowed (gkit.allowDiverged), in which case it passes but is surfaced as a default-level marker.
BehindKind
Whether a behind-base feature branch also carries unique commits.
BranchRule
Which correct-branch rule set applies — selected by gkit.solo. The two are mutually exclusive: exactly one runs. This is the single place that decides “when to use which rule”.
BranchVerdict
The outcome of the correct-branch check, rich enough to explain why it failed (surfaced by logoff -vv’s R5 reason line). Only the two passing variants make BranchVerdict::passed true.
RuleId
The five logoff checks, in run order, with stable R<n> ids. Single source of truth for logoff -vv line prefixes and the logoff -e catalog.

Functions§

all_commits_pushed
Every local commit exists on some remote: git log --oneline --branches --not --remotes is empty.
base_sync_verdict
Not behind base — the base-side twin of not_behind_remote (R4). On a feature branch, fails when the branch is behind base (either diverged — also ahead — or merged/stale — no unique commits). Integration branches are skipped (BaseSyncVerdict::NotApplicable). Fail-closed: detached HEAD or a base whose ref can’t be located → BaseSyncVerdict::Undeterminable. allow_diverged (gkit.allowDiverged) downgrades a Behind failure to a marked pass.
branch_verdict
Correct branch — a real-life “are you parked safely?” check (see docs/commands/logoff.md), returning a BranchVerdict that also explains a failure. Shared preamble for both rules:detached HEAD → fails (risky resting state; commits easily lost).on a feature branch (not base/main/master) → passes (actively on work).On an integration branch, exactly one rule runs (see BranchRule): Team flags a local unmerged feature branch; Solo flags any remote feature branch.
branches_have_remote
Every local branch has a remote counterpart (matched by short name).
committed
Nothing uncommitted: git status -s is empty.
correct_branch
Boolean form of branch_verdict — for callers that only need pass/fail.
current_branch
Current checked-out branch (git rev-parse --abbrev-ref HEAD); “HEAD” if detached.
evaluate
Run all six checks for a single repo at dir. An unresolved base (base.name == None) forces both base-dependent checks to fail — the base couldn’t be determined, so we can’t certify the right branch is checked out (R5) nor that it’s current with base (R6). The two are independent: each reports its own verdict. solo selects the correct-branch rule (gkit.solo; see BranchRule); allow_diverged (gkit.allowDiverged) downgrades an R6 behind-base failure to a marked pass.
not_behind_remote
Current branch is not behind origin/<branch> (nothing to pull). Fail-closed: if we can’t determine behind-ness — no current branch (detached / unborn), no matching remote-tracking ref, or an unparseable rev-list — the check fails rather than passing vacuously. It only passes when there’s a remote ref and the branch is genuinely not behind it.
rule_report
Gather the live, per-repo state behind one rule for the -e <N> deep dive. Reads git for a single repo (no submodule recursion, no fetch) and reuses the same git commands as the corresponding check, so the two can’t drift.