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§
- Repo
Status - Outcome of all six checks for one repo.
- Rule
Report - One rule’s deep-dive report for
logoff -e <N>: the live, per-repo state behind a single check, ready forcrate::report::print_rule_detailto render.
Enums§
- Base
Sync Verdict - 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.Behindfails unlessallowed(gkit.allowDiverged), in which case it passes but is surfaced as a default-level marker. - Behind
Kind - Whether a behind-base feature branch also carries unique commits.
- Branch
Rule - 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”. - Branch
Verdict - The outcome of the correct-branch check, rich enough to explain why it
failed (surfaced by
logoff -vv’sR5 reasonline). Only the two passing variants makeBranchVerdict::passedtrue. - RuleId
- The five logoff checks, in run order, with stable
R<n>ids. Single source of truth forlogoff -vvline prefixes and thelogoff -ecatalog.
Functions§
- all_
commits_ pushed - Every local commit exists on some remote:
git log --oneline --branches --not --remotesis 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 aBehindfailure to a marked pass. - branch_
verdict - Correct branch — a real-life “are you parked safely?” check (see
docs/commands/logoff.md), returning aBranchVerdictthat 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 (seeBranchRule):Teamflags a local unmerged feature branch;Soloflags any remote feature branch. - branches_
have_ remote - Every local branch has a remote counterpart (matched by short name).
- committed
- Nothing uncommitted:
git status -sis 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.soloselects the correct-branch rule (gkit.solo; seeBranchRule);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 unparseablerev-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.