stikk_model/current_branch.rs
1//! prikk's current branch, as prikk's own `status` report names it (RFC 030 decision 1).
2//!
3//! From prikk 0.42, `.prikk/current-branch` names a default for `--ref` ā *"a default, never an
4//! authority"* in prikk's words, and not a HEAD. stikk never reads that file (`CON-1`); it reads the
5//! `current branch:` line prikk prints in `status`, which the seam already parses.
6
7use crate::RefName;
8
9/// What prikk's `status` report says about its current branch.
10///
11/// **Three states, kept apart in the type** rather than folded into an `Option<String>` (`C-T2cā²`):
12/// "this prikk has no pointer", "prikk has a pointer it cannot resolve" and "prikk names this branch" are
13/// three different facts, and the change token hashes each distinctly so no two of them can compose the
14/// same token.
15#[derive(Debug, Clone, PartialEq, Eq, Hash)]
16pub enum CurrentBranch {
17 /// Below prikk 0.42, which prints no `current branch:` line: there is no pointer to report.
18 NotReported,
19 /// prikk has a pointer it cannot resolve ā malformed, or naming a branch that is missing or closed.
20 /// Carries prikk's text after the label **verbatim** (`ER-02`), e.g.
21 /// ``<unresolved; run `prikk doctor`>`` at prikk 0.42.0.
22 Unresolved(String),
23 /// The branch prikk's `--ref` default names, validated as a ref name at the parse boundary.
24 Branch(RefName),
25}