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
.gitfile orcommondirfile discovery reads.
Functions§
- canonical
fs::canonicalize, thenstrip_verbatim(design §5.4).- check_
commondir 🔒 - A
commondirentry, when present, must name an existing directory (design §5.2). - discover
- Finds the repository containing
start(design §5.1-§5.2). - examine 🔒
- Whether
diris a repository root;falsewhendir/.gitdoes not exist (design §5.2). - first_
line 🔒 - The first line without its line ending.
- is_file 🔒
- is_
proper_ ancestor - Whether
keyis an ancestor directory abovepath(and notpathitself). - prefix_
allowed 🔒 - read_
capped 🔒 - The file’s bytes, or
Nonewhen it is larger thanMAX_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, agitdirorcommondirtarget joined to its base (design §5.3). An allow-list: on Windows only a local drive, or the network sharerepository_diritself lives on. - unlink_
keys - The candidate mapping keys for
unlink --repo <repo>, in order, duplicates dropped (design §6.2).