Skip to main content

Module repo

Module repo 

Source
Expand description

Repository discovery (spec §13) and canonical repository identity (spec §14). SP3 design §5.

Discovery never runs Git and never reads Git configuration: it reads the .git entry, the existence of HEAD, and the capped contents of a .git file and its commondir (design D1).

Enums§

Discovery
The outcome of discovery.

Constants§

MAX_METADATA_FILE 🔒
The largest .git file or commondir file discovery reads.

Functions§

canonical
fs::canonicalize, then strip_verbatim (design §5.4).
check_commondir 🔒
A commondir entry, when present, must name an existing directory (design §5.2).
discover
Finds the repository containing start (design §5.1-§5.2).
examine 🔒
Whether dir is a repository root; false when dir/.git does not exist (design §5.2).
first_line 🔒
The first line without its line ending.
is_file 🔒
is_proper_ancestor
Whether key is an ancestor directory above path (and not path itself).
prefix_allowed 🔒
read_capped 🔒
The file’s bytes, or None when it is larger than MAX_METADATA_FILE.
repository 🔒
resolved 🔒
The canonical deepest existing ancestor of path, followed by the remaining components with . dropped and .. applied lexically.
strip_verbatim
Identity: Unix paths have no verbatim form.
target_allowed
Whether discovery may touch target, a gitdir or commondir target joined to its base (design §5.3). An allow-list: on Windows only a local drive, or the network share repository_dir itself lives on.
unlink_keys
The candidate mapping keys for unlink --repo <repo>, in order, duplicates dropped (design §6.2).