Expand description
Request-path -> (upstream URL, on-disk cache dir) resolution, hardened against path traversal.
Structs§
- RepoRef
- A resolved repository: where to fetch it from and where it is cached.
Constants§
- EVICTING_
SUFFIX - Reserved suffix for the trash directory a mirror is renamed to during eviction
before its (possibly slow) removal (see
git::GitCache::evict). Reserved for the same reason asINCOMING_SUFFIX: a client path must never alias a mirror mid-eviction. - INCOMING_
SUFFIX - Reserved suffix for the staging directory a mirror is cloned into before its
atomic rename into place (see
git::clone_mirror).resolverejects any client path containing it, so a request can never resolve onto another repo’s in-flight clone directory. - LFS_
OBJECTS_ DIR - Reserved top-level directory under the cache root holding cached git-LFS objects
(content-addressed by oid, shared across repos - see
lfs_object_path). Reserved like the suffixes above so a client repo path can never resolve into the LFS store.
Functions§
- lfs_
batch_ repo - Repo name for the LFS batch endpoint (
<repo>/info/lfs/objects/batch), orNoneif the path is not a batch request. - lfs_
object_ from_ path - Split an LFS object path (
<repo>/info/lfs/objects/<oid>) into(repo, oid). Any query string must be stripped by the caller.Noneif the path is not an object request or the oid is malformed. - lfs_
object_ key - Cache key of an LFS object: its path relative to the cache root,
/-joined so it matches the keys the eviction index uses for mirrors. Content-addressed and shared across all repos (the oid is the content hash), sharded by the first two hex chars so no single directory holds every object. Caller must pass avalid_lfs_oid. - lfs_
object_ path - On-disk path of a cached LFS object (
cache_rootjoined withlfs_object_key). - repo_
name_ from_ path - Strip a smart-HTTP endpoint suffix (
/info/refs,/git-upload-pack) from a request path and return the repo name.Noneif the suffix isn’t present. - resolve
- Validate a repo path (no traversal / absolute / NUL) and resolve it against the upstream base and cache root.
- valid_
lfs_ oid - An LFS oid is the lowercase-hex sha256 of the object’s content: 64 hex digits. Validated before use as both a filesystem path component and the cache key.