Expand description
mkit ref list [--pattern <glob>] / mkit ref cat <name> — stable
ref-inspection plumbing (#652).
The epic (#634) settled on keeping refs as plain loose files rather
than migrating them to a denser storage primitive, but that decision
only holds up if “ls-able” is satisfied by a stable command surface
rather than by shelling out to ls/cat on .mkit/refs/. These two
commands are that surface, modeled on git’s for-each-ref/show-ref
plumbing:
ref listprints every ref’s full name and resolved hash, one per line as<refname> <hash>, sorted lexicographically by name. Coversrefs/heads/*,refs/tags/*, andrefs/remotes/*/*— the same read scope asshow-ref/for-each-ref. An empty repo prints nothing and still exits 0 (unlikeshow-ref, whose “nothing matched” exit-1 convention is a git-inherited existence test, not what a structured listing command should do).--pattern <glob>filters to full ref names matching a shell glob (*spans/,?/[...]supported — seesuper::branch::glob_match).ref cat <name>prints the resolved hash for exactly one ref, followingHEAD’s symbolic indirection (HEADis mkit’s only symbolic ref: it either names a branch or holds a detached hash).<name>must be a fully-qualified ref name —refs/heads/<b>,refs/tags/<t>,refs/remotes/<r>/<b>— or the literalHEAD; these are exactly the namesref listprints, so the two commands round-trip.
Both commands are read-only and reuse mkit-core::refs’s existing
read/list helpers (read_ref, read_tag, read_remote_ref,
resolve_head, list_refs, list_tags, list_remote_refs,
list_remote_names) — no new storage-layer code.