Skip to main content

Module refs

Module refs 

Source

Functions§

list_refs
Enumerate every ref in git_dir: the loose refs/** tree, packed-refs, and HEAD (when it resolves to a hash). Returns (refname, target_hash) pairs. Unresolvable or malformed refs are skipped; never panics.
list_refs_checked
Like list_refs but fails loud on a ref-enumeration I/O error instead of silently returning fewer refs. A genuine failure to read the refs subsystem (e.g. refs/ present but unreadable, a packed-refs that exists but can’t be read) is a bootstrap failure: callers that compute reachability from these refs (the unreachable-object audit) must NOT treat it as “zero refs” — that would flag every object as orphaned (a false-positive inversion). A genuinely absent file/dir (NotFound) is the legitimate empty case and is NOT an error.
resolve_ref
Resolve a ref name to its target hash.